Hazrat Muhammad ﷺ: The Hijrah and the Building of Madinah

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 courtyard of the Prophet's Mosque in Madinah, built by Hazrat Muhammad ﷺ after the Hijrah
The courtyard of the Prophet’s Mosque in Madinah — the first building Hazrat Muhammad ﷺ raised on arriving, and the heart of the new community. (Photo: Wikimedia Commons, CC BY-SA 4.0)

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.

Yathrib was ready for such a message in a way Makkah was not. Its Arab tribes, Aws and Khazraj, had bled each other in generations of feud, and its people were weary of bloodshed; its Jewish tribes, learned in scripture, spoke of a prophet to come, so the very idea of prophethood was familiar there. At the first pledge of Aqabah, twelve men promised to worship Allah alone, to keep the prayer, and to obey the Prophet ﷺ; he sent Hazrat Mus’ab ibn Umayr (RA) back with them, and the young teacher went from house to house in Yathrib until scarcely a home remained untouched by the message. A year later, at the second pledge, seventy-three men and two women came to him in the darkness of the pilgrimage night and pledged something far greater: to protect him as they protected their own wives and children, in war and in peace. When one of them asked what they would receive in return, he answered with a single word — Paradise. It was on the strength of that pledge, made in the dark by men who had counted the cost, that the migration became possible at all: a city had already promised to receive him before he ever set foot in it.

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.

The plot hatched in Dar al-Nadwah was cold and deliberate: rather than one assassin, whose clan would face revenge, a young swordsman from every clan of the Quraysh would strike together, so that the blood-guilt would fall upon all and no single clan could be blamed. Against this, the Prophet’s ﷺ answer was not force but trust in Allah joined to careful planning. Hazrat Ali (RA) took his place in the bed, wrapped in his green cloak, so that the watchers at the door would see a sleeper and wait; and before he left, the Prophet ﷺ entrusted him with the trusts — the valuables Makkah’s own people, including his enemies, had deposited with him because they knew him as Al-Amin. Even on the night of his flight, not a single trust would be left unreturned. He slipped out reciting the opening verses of Surah Ya-Sin, in which Allah speaks of a barrier set before the disbelievers and behind them, so that they cannot see — and the ring of swordsmen did not see him pass. It was the pattern of the whole Hijrah: the most complete trust in Allah, expressed through the most complete use of the means Allah had placed in his hands.

Jabal Thawr, a rugged rocky mountain south of Makkah
Jabal Thawr — in its cave, Hazrat Muhammad ﷺ and Hazrat Abu Bakr (RA) sheltered for three days while Makkah searched for them. (Photo: Wikimedia Commons, CC BY-SA 3.0)

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.

The three days in the cave were sustained by a family’s devotion. Hazrat Asma (RA), the daughter of Abu Bakr, carried food up the mountain each night, and when she found she had nothing to tie the provisions with, she tore her own waistband in two — earning from the Prophet ﷺ the title Dhat an-Nitaqayn, “She of the Two Belts”. Her brother Abdullah spent his days in Makkah listening to the talk of the Quraysh, then slipped to the cave by night to report what he had heard, while the shepherd Amir ibn Fuhayrah drove his flock over the trail behind them so that no footprints would betray the path. When the searchers stood at the mouth of the cave, so close that Abu Bakr whispered of being seen, the Prophet’s ﷺ calm did not waver — for he knew that the One who had brought them there unseen would keep them unseen. The pursuit of Suraqah ibn Malik, the horseman chasing the bounty of a hundred camels, ended the same way: three times his horse sank into the earth, and three times he begged for mercy, until he turned back carrying the Prophet’s astonishing promise that one day he would wear the bracelets of Kisra, the emperor of Persia. A generation later, under the caliphate of Hazrat Umar (RA), when the treasures of Persia were brought to Madinah, Suraqah was called forward and the bracelets were placed upon his arms — and the promise made on a lonely road was kept before the eyes of all.

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.

Quba itself is remembered with honour in the Quran, which praises its mosque as one “founded on righteousness from the first day” (Quran 9:108), and the narrations record a special reward for prayer offered there. The Prophet ﷺ stayed among its people for some days, laying the foundations with his own hands before riding on to Madinah on a Friday, where the whole city — men, women and children upon the rooftops — sang Tala’a al-badru alayna, “The full moon has risen over us.” Every clan chief seized his camel’s rein, and to each he gave the same gracious answer: “Let her go her way, for she is guided.”

Masjid Quba in Madinah, a white mosque with domes and minarets
Masjid Quba — the first mosque of Islam, founded by Hazrat Muhammad ﷺ in the days of his arrival after the Hijrah. (Photo: Wikimedia Commons, CC BY-SA 4.0)

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.

The mosque the community raised was far more than a place of prayer. Built of unbaked brick with a roof of palm leaves and a floor of sand, it was at once a school where the Quran was taught, a council where the affairs of the city were decided, a court where disputes were settled, and a shelter for the poor of the Suffah — the companions who had no home in Madinah and lived upon its shaded bench, fed from whatever the Prophet ﷺ and his people could spare. The brotherhood was no mere ceremony either: when the Ansar offered to divide their date orchards and their wealth in half, the Muhajirun refused with a dignity that became a byword, asking only to be shown the way to the marketplace — and within a short time, by honest trade, many of them stood on their own feet. And the Charter, the document that bound them all, was remarkable even by the standards of later centuries: it named the Muslims, the Jews and the pagans of Madinah as a single community, guaranteed each group the freedom of its religion, bound them all to the mutual defence of the city, and made the Prophet ﷺ the final arbiter in every dispute. It was, in the judgement of historians, one of the earliest written constitutions in the world — and it was written not by a conqueror, but by a migrant who had arrived in Madinah with nothing but his faith and his companions.

A date palm farm in Madinah, with rows of tall palm trees
The date farms of Madinah — the Ansar offered to share their orchards with their Makkan brothers after the Hijrah. (Photo: Wikimedia Commons, CC BY-SA 3.0)
Mount Uhud in Madinah, a long rocky ridge rising above the plain
Mount Uhud, overlooking Madinah — the city that welcomed Hazrat Muhammad ﷺ and became the home of Islam. (Photo: Wikimedia Commons, CC BY 4.0)

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.

Test Your Knowledge

Five questions on the Hijrah and the building of Madinah — every answer is found in the article above.

1. In which year did the Hijrah from Makkah to Madinah take place?

  1. 610 CE
  2. 622 CE
  3. 630 CE
  4. 632 CE

2. Who slept in the Prophet’s ﷺ bed on the night of the migration, so the assassins would believe he was still in the house?

  1. Hazrat Umar (RA)
  2. Hazrat Hamzah (RA)
  3. Hazrat Ali (RA)
  4. Hazrat Bilal (RA)

3. In which cave did Hazrat Muhammad ﷺ and Hazrat Abu Bakr (RA) shelter for three days during the Hijrah?

  1. Cave Hira
  2. Cave Thawr
  3. Cave Uhud
  4. Cave Badr

4. What was the first mosque founded in Islam, built at Quba on the Prophet’s ﷺ arrival?

  1. The Prophet’s Mosque
  2. Masjid al-Haram
  3. Masjid Quba
  4. Masjid al-Aqsa

5. Under the Charter of Madinah, which groups were bound together into one community with freedom of religion?

  1. Muslims only
  2. Muslims and Jews only
  3. Muslims, Jews and pagans of Madinah
  4. Muslims and Christians only

Answer Key: 1 – B, 2 – C, 3 – B, 4 – C, 5 – C

Conclusion

The Hijrah was not a flight; it was a founding. A persecuted preacher left Makkah by night and arrived in Madinah to build a mosque, a brotherhood and a charter — and from those three foundations rose a civilisation whose calendar still begins from that journey. The lesson of the road to Madinah is that Allah’s help comes to those who prepare: a decoy in the bed, a cave off the route, a guide, a food chain, a city’s pledge — and above all, the calm of a man who knew that Allah was the third of the two in the cave.

Every Islamic year still dawns from this migration, reminding the Ummah that its history begins not with a birth or a battle, but with a journey for the sake of Allah and a city built on faith, brotherhood and law. To honour the Hijrah is to build the same way: worship first, brotherhood next, and justice for every neighbour, whatever their faith.

Continue Reading: The Blessed Seerah of Hazrat Muhammad ﷺ

Explore more from the blessed life of Hazrat Muhammad ﷺ in this special series:

Sources and References

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.

0Shares

Leave a Reply

Your email address will not be published. Required fields are marked *