They were given shelter by members of the indigenous community known as the Ansar. After having established the first mosque in Medina and obtaining residence with Abu Ayyub al-Ansari,[27] he then 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.[28]