Abu Ayyub al-Ansari
After the pledges at al-'Aqaba, Muhammad received promises of protection from the people of Medina and he migrated to Medina with a group of his followers in 622, having escaped the forces of Quraysh. They were given shelter by members of the indigenous community known as the Ansar. After having established the first mosque in Medina (the "Masjid an-Nabawi") and obtaining residence with Abu Ayyub al-Ansari, he set about the establishment of a pact known as the Constitution of Medina (). This document was a unilateral declaration by Muhammad, and deals almost exclusively with the civil and political relations of the citizens among themselves and with the outside.