In the year 622 CE, Hazrat Muhammad ﷺ slipped out of Makkah by night, past the swordsmen waiting at his own door, and began the most consequential journey in Islamic history: the Hijrah, the migration to Madinah. It was not a retreat. It was the founding of a civilisation — the moment a persecuted preacher became the builder of a community, a city and a state governed by justice. In Madinah he ﷺ raised the first mosque, bound emigrants and helpers into a single brotherhood, and signed a charter that protected Muslims, Jews and pagans as one community — fourteen centuries before the modern world coined the word pluralism. The Islamic calendar itself begins from this journey. This is the story of the Hijrah and the building of Madinah, told from the authentic sources of the Seerah.
A Brief Overview: After the pledges of Aqabah from the people of Yathrib (Madinah), Hazrat Muhammad ﷺ migrated from Makkah in 622 CE, evading a Quraysh assassination plot, sheltering three days in Cave Thawr with Hazrat Abu Bakr (RA), and arriving first at Quba — where he founded the first mosque — then at Madinah, where he built the Prophet’s Mosque, established brotherhood between the Muhajirun and the Ansar, and issued the Charter of Madinah.

The Road Opens: The Pledges of Aqabah
The door to Madinah opened during the pilgrimage seasons, when Hazrat Muhammad ﷺ presented his message to the visiting tribes. Men from Yathrib — a farming city of date palms some three hundred miles north of Makkah, torn by generations of feud between its Arab tribes of Aws and Khazraj and home to learned Jewish tribes — listened, believed, and returned home as missionaries. Twice they came to pledge themselves at Aqabah: first twelve men, then seventy-three men and two women, who pledged in the darkness to protect the Prophet ﷺ as they protected their own families. He sent with them Hazrat Mus’ab ibn Umayr (RA), whose gentle teaching prepared the city house by house. Then the command came: the believers began leaving Makkah quietly, in small groups, until the city was nearly empty of Muslims — and the Quraysh understood that a rival centre of power was rising in the north. Their answer was a plot.
The Night of the Migration
The council of Quraysh, Dar al-Nadwah, resolved on murder: a young swordsman from every clan would strike together, so that the blood-guilt would be shared by all and his clan could not take revenge. But Allah informed His Messenger ﷺ of the plot, and the night of the assassination became the night of the Hijrah. In his house, Hazrat Muhammad ﷺ gave his final Makkan instructions to Hazrat Ali (RA): sleep in my bed under my cloak, so the watchers believe I am still here — and after I leave, return to every owner the trusts they deposited with me. The Al-Amin would not flee his city owing any man his property, even the men outside his door with swords. Ali (RA) slept in the bed; the Prophet ﷺ walked out through the ring of assassins, reciting the opening verses of Surah Ya-Sin, and by Allah’s protection passed unseen. With Hazrat Abu Bakr (RA) — who had prepared two camels and provisions for this very day — he turned not north toward Madinah, but south, to a cave in Mount Thawr.

Three Days in Cave Thawr: “Do Not Grieve”
For three days the two hid in the cave while Quraysh scoured the mountains, a hundred camels offered for their capture. Abu Bakr’s family ran the lifeline: his son Abdullah brought news of Makkah by night, his daughter Hazrat Asma (RA) carried food — tearing her own waistband in two to tie the provisions, and earning the title “She of the Two Belts” — and his shepherd Amir grazed his flock over their tracks. Then came the moment the Quran immortalised: the pursuers reached the very mouth of the cave, so close that Abu Bakr whispered, “If one of them looks down at his feet, he will see us.” The Prophet ﷺ answered with the calm that defines the whole journey: “O Abu Bakr, what do you think of two, when Allah is their third?” — and Allah revealed: “Do not grieve; indeed Allah is with us” (Quran 9:40). The searchers turned away. On the fourth day, with a trusted guide, the party took the little-used coastal road north. The horseman Suraqah, chasing the bounty, galloped after them — and three times his horse sank into the earth before he begged for mercy and turned back, carrying the Prophet’s astonishing promise that one day he would wear the bracelets of the emperor of Persia. A generation later, he did.
Quba and the Entry into Madinah
At Quba, on the edge of Madinah, the Prophet ﷺ rested some days and laid the foundations of the first mosque built in Islam — Masjid Quba, which the Quran itself praises as “a mosque founded on righteousness” (Quran 9:108). Then, on a Friday, he rode into Madinah itself. The whole city had poured out to receive him: men, women and children on the rooftops and in the streets, singing the song every Muslim child still learns — Tala’a al-badru alayna, “The full moon has risen over us.” Every clan chief seized his camel’s rein begging him to stay with them, and to each he gave the same gracious answer: “Let her go her way, for she is guided” — until the camel knelt in an open courtyard belonging to two orphan boys. There, he declared, would be his mosque and his home. He would not accept the land as a gift; the orphans were paid their price. The most wanted man in Arabia had arrived as its most honoured guest, and his first act was to build.

Building a Community: Mosque, Brotherhood and Charter
The work of Madinah proceeded in an order that teaches statecraft to this day. First, the mosque: the Prophet’s Mosque was raised by the whole community, the Prophet ﷺ carrying bricks alongside the humblest believer — a house of worship that was also school, parliament and shelter for the poor of the Suffah. Second, the brotherhood: he joined each Makkan emigrant (Muhajir) to a Madinan helper (Ansari) as a brother in faith — a bond so real that Ansar offered to divide their wealth and their date orchards in two, and the Muhajirun, with characteristic dignity, asked only to be shown the way to the marketplace. Third, the Charter: a written covenant binding the tribes of Madinah — Muslims, Jews and pagans — into one community (ummah), guaranteeing the security of life and property, freedom of religion (“the Jews have their religion and the Muslims have theirs”), mutual defence of the city, and the Prophet ﷺ as the final arbiter of disputes. Historians regard it as among the earliest written constitutions in the world. Around these three pillars — worship, brotherhood and covenant — a fractured oasis of feuding tribes became a single, ordered, believing city.


Lessons from the Hijrah
The Hijrah is the believer’s lesson in how change truly happens. It was not improvised: it combined complete trust in Allah with complete use of earthly means — a decoy in the bed, a cave off the route, a guide, a food chain, intelligence from the city. “Tie your camel, then trust in Allah,” as he ﷺ taught. It teaches that community is built, not found: mosque before palace, brotherhood before bureaucracy, covenant before conquest. And it teaches what leadership looks like at its founding moment — the leader carrying bricks, paying orphans a fair price, and writing the rights of minorities into the city’s first document. Every Islamic year that dawns is dated from this journey, so that the calendar of a civilisation begins not with a birth or a battle, but with a migration for the sake of Allah — and a city built on faith, brotherhood and law.
Key Events of the Hijrah and the Building of Madinah
| Year | Event |
|---|---|
| 621–622 CE | The two pledges of Aqabah; Madinah prepares to receive the Prophet ﷺ |
| 622 CE | The assassination plot; Hazrat Ali (RA) sleeps in his bed; the trusts are returned |
| 622 CE | Three days in Cave Thawr with Hazrat Abu Bakr (RA) — “Do not grieve; Allah is with us” |
| 622 CE | The pursuit of Suraqah; the journey north by the coastal road |
| 622 CE | Arrival at Quba; foundation of the first mosque of Islam |
| 622 CE | The entry into Madinah; building of the Prophet’s Mosque |
| 622–623 CE | Brotherhood of Muhajirun and Ansar; the Charter of Madinah |
Frequently Asked Questions About the Hijrah
Why is the Hijrah so important in Islam?
The Hijrah marks the founding of the first Muslim community and state in Madinah, where Islam could be practised openly and its social order established. The Islamic (Hijri) calendar begins from the year of the Hijrah, 622 CE.
What happened in Cave Thawr?
Hazrat Muhammad ﷺ and Hazrat Abu Bakr (RA) hid in Cave Thawr, south of Makkah, for three days while the Quraysh searched for them. When the pursuers reached the cave’s mouth, the Prophet ﷺ reassured Abu Bakr (RA): “What do you think of two, when Allah is their third?” — commemorated in Quran 9:40.
What was the Charter of Madinah?
A written covenant issued by Hazrat Muhammad ﷺ after the Hijrah, uniting the tribes of Madinah — Muslims, Jews and pagans — into one community. It guaranteed security of life and property, freedom of religion, and mutual defence, and is considered one of the earliest written constitutions in history.
What was the first mosque built in Islam?
Masjid Quba, founded by Hazrat Muhammad ﷺ at Quba on his arrival from Makkah, before he entered Madinah itself. The Quran praises it as a mosque “founded on righteousness” (9:108), and prayer there carries a special reward.
Continue Reading: The Blessed Seerah of Hazrat Muhammad ﷺ
Explore more from the blessed life of Hazrat Muhammad ﷺ in this special series:
- Hazrat Muhammad ﷺ: Life, Character and Legacy of the Mercy to the Worlds
- Hazrat Muhammad ﷺ: Blessed Birth and Childhood of the Prophet of Mercy
- Hazrat Muhammad ﷺ: Al-Amin and His Marriage to Hazrat Khadijah (RA)
- Hazrat Muhammad ﷺ: The First Revelation and the Makkan Years
- Hazrat Muhammad ﷺ: Isra and Mi’raj — The Miraculous Night Journey
- Hazrat Muhammad ﷺ: His Noble Character and Daily Life
- Hazrat Muhammad ﷺ: The Conquest of Makkah and the Great Amnesty
- Hazrat Muhammad ﷺ: The Farewell Sermon and His Final Days
- Hazrat Muhammad ﷺ: His Blessed Family and Household
- All Articles in the Hazrat Muhammad ﷺ Category
Sources and References
- The Holy Quran — verse 9:40 on Cave Thawr and verse 9:108 on Masjid Quba, via Quran.com.
- Sahih al-Bukhari — the long narration of the Hijrah from Hazrat Aisha (RA).
- Ar-Raheeq Al-Makhtum (The Sealed Nectar) — Safiur Rahman Mubarakpuri, chapters on the Hijrah and Madinah.
- The Seerah of Ibn Hisham — including the text of the Charter of Madinah.
Follow Alive Gems
Website · Pinterest · YouTube · Instagram · Facebook · Medium · Reddit
New true stories from history — every week, everywhere you read and watch.
May Allah’s peace and blessings be upon Hazrat Muhammad ﷺ, upon his family and upon his companions — always and forever.
