In his first years Muhammad made few converts but many enemies. His first converts were Khadija, Ali (who became the husband of Fatima), and Abu Bakr. From about 620, Mecca became actively hostile, since much of its revenues depended on its pagan shrine, the Kaaba, and an attack on the existing Arab religion was an attack on the prosperity of Mecca. While he was gaining only enemies at home, Muhammad's teaching was faring little better abroad; only at Yathrib did it make any headway, and on Yathrib depended the future of Islam. In the summer of 622 Muhammad fled from Mecca as an attempt was being prepared to murder him, and he escaped in the night from the city and made his way to Yathrib. From this event, the flight, or Hegira, of the Prophet (622), the Islamic calendar begins.
Muhammad spent the rest of his life at Yathrib, henceforth called Medina, the City of the Prophet. At Medina he built his model theocratic state and from there ruled his rapidly growing empire. Muhammad's lawgiving at Medina is at least theoretically the law of Islam, and in its evolution over the next 10 years the history of the community at Medina is seen.
Medina lies on the caravan route N of Mecca, and the Kuraishites of Mecca could not endure the thought of their outlawed relative taking vengeance on his native city by plundering their caravans. A pitched battle between Muhammad's men and the Meccans occurred at Badr, and the victory of an inferior force from the poorer city over the men of Mecca gave Islam great prestige in SW Arabia. More than a year later the battle of Uhud was fought but with less fortunate results. By this time pagan Arabia had been converted, and the Prophet's missionaries, or legates, were active in the Eastern Empire, in Persia, and in Ethiopia.
As he believed firmly in his position as last of the prophets and as successor of Jesus, Muhammad seems at first to have expected that the Jews and Christians would welcome him and accept his revelations, but he was soon disappointed. Medina had a large Jewish population which controlled most of the wealth of the city, and they steadfastly refused to give their new ruler any kind of religious allegiance. Muhammad, after a long quarrel, appropriated much of their property, and his first actual conquest was the oasis of Khaibar, occupied by the Jews, in 628. The failure of several missions among the Christians made him distrustful of Christians as well as Jews.
His renown increased, and in 629 he made a pilgrimage to Mecca without interference. There he won valuable converts, including Amr and Khalid (who had fought him at Uhud). In 630 he marched against Mecca, which fell without a fight. Arabia was won. Muhammad's private life—the fact that he had nine wives—has received a vast, and perhaps disproportionate, amount of attention. His third wife, Aishah, was able and devoted; he died in her arms June 8, 632.