Abu Ayyub al-Ansari
Muhammad emigrated to Yahtrib in September 622, he arrived with a group of his followers, who were given shelter by members of the indigenous community known as the Ansar. Amongst his first actions were the construction of the first mosque in Medina, as well as obtaining residence with Abu Ayyub al-Ansari. He then set about the establishment of a pact, known as the Constitution of Medina, between the Muslims, the Ansar, and the various Jewish tribes of Medina to regulate the matters of governance of the city, as well as the extent and nature of inter-community relations. The conditions of the pact included boycotting Quraysh, abstinence from "extending any support to them", assistance of one another if attacked by a third party, as well as "defending Medina, in case of a foreign attack".