Thirteen years of preaching in Mecca had won the Prophet Muhammad ﷺ a small, devoted community and a great deal of enmity. In 622 CE, that enmity turned lethal, and a single night's escape reshaped the future of the new faith — and, eventually, its calendar.

The plot

As the pledges at Aqabah drew more of Yathrib's people toward the Prophet's ﷺ message, Mecca's leading clans concluded that exile was no longer enough; they needed him dead. According to the traditional accounts, Quraysh's chiefs settled on a plan meant to defeat the normal check on murder in tribal Arabia — retaliation. If a young man from every clan struck the fatal blow together, the Prophet's ﷺ own clan, Banu Hashim, would have no single family to hold to account and no realistic way to seek revenge.457 The Quran refers to this scheming in terms that later commentators connected to the plot:

And [remember, O Muhammad], when those who disbelieved plotted against you to restrain you or kill you or evict you [from Mecca]. But they plan, and Allah plans. And Allah is the best of planners.

— Quran 8:30 (Saheeh International)1

Warned in time, the Prophet ﷺ asked his young cousin Ali ibn Abi Talib to remain behind in his bed as a decoy and to return some goods entrusted to him by Meccans who, despite everything, still trusted his honesty. He then slipped out of the house and out of the city with his closest companion, Abu Bakr, who had been quietly preparing supplies and mounts for the journey for some time.457

The cave of Thawr

Rather than take the direct northern road toward Yathrib, where pursuers would expect them, the two men headed south first, to a cave in the mountain of Thawr, and waited there while Meccan search parties combed the countryside. The traditional sira literature — the classical biographical accounts of the Prophet's ﷺ life — describes riders coming close enough to the cave's mouth to be seen, at which point Abu Bakr, fearing for the Prophet's ﷺ life, is said to have voiced his fear. The Quran preserves the Prophet's ﷺ reply as part of its own account of the episode:

If you do not aid the Prophet - Allah has already aided him when those who disbelieved had driven him out [of Mecca] as one of two, when they were in the cave and he said to his companion, "Do not grieve; indeed Allah is with us."

— Quran 9:40 (Saheeh International)2

After three days, once the search had cooled, the pair set out on a longer, less obvious route toward Yathrib, guided by a hired guide, Abd Allah ibn Urayqit, who knew paths that avoided the main caravan roads.457

Suraqah's pursuit

Not every pursuer gave up so easily. Sahih al-Bukhari preserves an account, narrated by the companion Al-Bara ibn Azib, of how the tracker Suraqah ibn Malik caught up with the two men alone, hoping to claim a bounty Quraysh had placed on the Prophet's ﷺ capture. Abu Bakr, seeing him approach, feared they had been found out, but the Prophet ﷺ reassured him before Suraqah's horse was stopped by what the hadith describes as divine intervention:

Abu Bakr said, "We have been discovered, O Allah's Messenger!" He said, "Don't grieve, for Allah is with us." ... So the legs of his (Suraqah's) horse sank into the earth up to its belly.

— Sahih al-Bukhari 36153

The traditional accounts add a detail beyond what the hadith itself narrates: that the Prophet ﷺ promised Suraqah the bracelets of the Persian emperor, a promise recalled decades later, after Persia's fall to Muslim armies, when the caliph Umar reportedly presented Suraqah with the bracelets in fulfillment of a pledge he could hardly have believed possible at the time.478

Quba, Medina, and a calendar begins

The two men eventually reached Quba, a settlement just outside Yathrib, where the Prophet ﷺ paused to build a mosque — traditionally remembered as the first mosque of Islam — before completing the short remaining distance into the city itself. Yathrib was soon renamed Madinat an-Nabi, "the city of the Prophet," shortened to Medina.456 The migration itself, the Hijra, gave its name to the new reckoning of time that the Muslim community adopted years later: the Islamic lunar calendar counts its years from 622 CE, so that dates are marked "AH," anno Hegirae. The fuller story of that calendar is told in the Islamic calendar and festivals.

Brothers by pact

Medina's Muslims already included converts from two large Arab tribes, the Aws and the Khazraj, alongside Jewish tribes long settled in the oasis. To knit Meccan migrants — the Muhajirun — into this existing community, the Prophet ﷺ formally paired each migrant with a Medinan host, an Ansari ("helper"), in a bond of brotherhood that in the community's early years carried real weight: shared housing, shared property, and in the earliest reports even mutual inheritance.458 It was a practical answer to an urgent problem — the migrants had left behind homes, trade, and income — and it became one of the most fondly remembered episodes of early Islamic history, cited ever since as a model of solidarity between believers.

The Constitution of Medina

Soon after his arrival, the Prophet ﷺ set down, or is traditionally credited with setting down, a document that historians now generally call the Constitution of Medina (also the Covenant, or Sahifat al-Madinah). Preserved by the early biographer Ibn Ishaq, it bound the Muslims of Quraysh and Yathrib together with the city's Jewish tribes as a single political community, or ummah, with mutual obligations of defense, agreed procedures for resolving disputes, and recognition that each religious community would continue to follow its own law in internal matters.458 Historians disagree about exactly how much of the surviving text reflects a single original moment versus a compilation of related agreements made over time, but there is broad scholarly agreement that it represents an early and remarkably explicit attempt to organize a religiously mixed city around shared citizenship rather than tribal loyalty alone — pluralism set down in writing at the very founding of the first Muslim polity.568

Where to go next

The Hijra turned a persecuted movement into a governed community with a city of its own. What that community built, defended, and became over the following decade is the story of the Medinan years.