Shortly after arriving in Madinah, the Prophet Muhammad ﷺ drew up a written agreement, often called the Constitution or Charter of Madinah, among the Muslim emigrants (Muhajirun), the local Muslim converts (Ansar), and the Jewish tribes residing in the city. Preserved in early biographical sources such as Ibn Ishaq's sira, the document established these groups as one political community while explicitly preserving each group's religious practices, internal legal autonomy, and property rights. It set out mutual obligations for the collective defense of Madinah against outside attack, mechanisms for resolving disputes, and a rule that no signatory could make a separate peace during war without consulting the others. Historians often cite the Constitution of Madinah as one of the earliest known written agreements establishing a pluralistic political order, built on shared civic obligation rather than tribal or religious identity alone. While its exact wording and dating are debated among scholars, its broader significance is clear: it shows that formal agreements, legal pluralism, and cooperation with non-Muslim communities were part of the Muslim community's governance from its very founding in Madinah.
No specific citation was provided for this answer. Verify with a qualified scholar and the primary sources.