In 622, Medina became the seat of Muhammad's growing movement after the Hegira. His house here is considered to be the first mosque. In 622 Muhammad was invited to come and live in Yathrib (the old name of Medina) and act as a sort of governor. Medina in those times was a divided city. Different clans and religions were eternally quarrelling and bickering and Muhammad brought unity to the city. All parties agreed to a pact drawn up by Muhammad and his followers. He invited all people in the city to follow the new religion of Islam. He had trouble however to convince the Jewish population (which was actually quite large) that Islam was the true version of Judaism.
When the Jews refused to convert, the qibla was changed from Jerusalem to Mecca. A small group of converted Jews, however, stuck to the original qibla. They were known as the sect of the Qibla al-Qudsiyya.
In the ten years following the Hegira, Medina formed the basis form where Muhammad attacked and finnaly conquered Mecca. Even when islamic rule was established Medina remained for some years the most important city of Islam and the de facto capital of the Caliphate.
Under the first four Caliphs, known as the Righteous Caliphs, the Islamic empire expanded rapidly and came to include centres of learning such as Jerusalem, Ctesiphon and Damascus. After the death of Ali, the fourth caliph, Mu'awiyya transferred the capital to Damascus and the importance of Medina dwindled and became of a religious more than a political nature.
This is about the Saudi city of Medina. For other uses, see Medina (disambiguation).