Skip to main content
Masaajidh
QuranIqraHadithDuasHistoryLearnCourses
Guided ProgramMosquesCharacterMobile App
Sign InGet Started
Masaajidh
Sign InRegister

Learn or teach the Quran online with Masaajidh

For students and parents

Learn Quran online with a live teacher

Quran classes for kids and adults: Iqra reading, Tajweed classes, recitation and Hifz. Free trial class.

See Quran classes →

For teachers

Teach Quran online: we are hiring

Online Quran teacher jobs for Quran, Tajweed, Arabic and Islamic studies tutors. Flexible hours, from home.

Apply to teach →
Masaajidh
Masaajidhمساجد

A sacred space for Islamic learning and knowledge. Building understanding, strengthening faith, and connecting hearts to the wisdom of our tradition.

Learn

  • Iqra Books
  • Quran
  • Learn Quran Online
  • Courses
  • Teachers

Resources

  • Seerah
  • Tafseer
  • Hadith
  • History
  • Pioneers
  • Daily Duas

Community

  • Mosques
  • Events
  • Blog
  • Teach Quran Online
  • Support

Get the App

  • iPhone — App Store
  • Android — coming soon
  • About the app

About

  • Our Mission
  • Contact Us
  • Privacy Policy
  • Terms of Service
  • Refund Policy

Subscribe to our Newsletter

Receive weekly Islamic reminders and learning resources

سُبْحَانَ اللَّهِ وَبِحَمْدِهِ

© 2026 Masaajidh.com. All rights reserved.

Privacy✦Terms✦Cookies
The Hijrah: Migration to Madinah Explained | Masaajidh
Back to Blog

The Hijrah: The Migration to Madinah Explained

Masaajidh Editorial Team
October 27, 2026
10 min read
Seerah & History
The Hijrah: The Migration to Madinah Explained

The Hijrah is the migration of Prophet Muhammad ﷺ and his companions from Makkah to Madinah in 622 CE. It turned a persecuted minority into a community with a home, a mosque and a way of life, and it became the starting point of the Islamic calendar. This guide explains why the migration happened, what took place in the cave of Thawr, how the Prophet ﷺ arrived in Madinah, and how the Hijri calendar came to be.

This is part of our guide to The Seerah: A Timeline of the Life of Prophet Muhammad ﷺ. To see the events on an interactive timeline, open our Seerah timeline and mindmap.

What does hijra mean?

The Arabic word hijra (الهجرة) means to leave something or to move away from it. In Islamic history it refers above all to the move from Makkah to Madinah, but the word is wider than one journey. The first hadith in Sahih al-Bukhari uses it to teach that every deed is judged by its intention: "The reward of deeds depends upon the intentions and every person will get the reward according to what he has intended. So whoever emigrated for worldly benefits or for a woman to marry, his emigration was for what he emigrated for." (Sahih al-Bukhari, no. 1 (Masaajidh edition).)

There was an earlier migration too: around 615 CE small groups of Muslims crossed the Red Sea to Abyssinia, where the Christian king, the Negus, protected them. But when Muslims say "the Hijrah", they mean the move to Madinah.

Why the migration to Madinah happened

By around 619 CE the situation in Makkah had become very hard. The Prophet ﷺ lost his uncle Abu Talib, whose clan protection had kept him safe, and his wife Khadijah (may Allah be pleased with her), who had supported him from the first day of revelation. Muslims had already endured a boycott in the valley of Abu Talib. A visit to Ta'if to seek support ended in rejection.

Help came from an unexpected place. During the pilgrimage season, people from Yathrib, the oasis town later called Madinah, met the Prophet ﷺ at a place called Aqabah near Mina. In the first pledge of Aqabah (about 621 CE) a small group accepted Islam, and the Prophet ﷺ sent Mus'ab ibn 'Umayr back with them as a teacher. The following year a larger group, around seventy by most reports, made the second pledge: they promised to protect the Prophet ﷺ as they protected their own families.

The Aws and the Khazraj, the two main tribes of Yathrib, were worn out by years of feuding and hoped he could bring peace. After the second pledge, the companions began leaving Makkah quietly, in small groups.

The plot in Makkah and the night of departure

When the leaders of Quraysh realised that Muslims were leaving and that the Prophet ﷺ might soon follow, they met to decide what to do. The Quran describes their choices:

وَإِذْ يَمْكُرُ بِكَ ٱلَّذِينَ كَفَرُوا۟ لِيُثْبِتُوكَ أَوْ يَقْتُلُوكَ أَوْ يُخْرِجُوكَ ۚ وَيَمْكُرُونَ وَيَمْكُرُ ٱللَّهُ ۖ وَٱللَّهُ خَيْرُ ٱلْمَٰكِرِينَ

"And [remember, O Muhammad], when those who disbelieved plotted against you to restrain you or kill you or evict you [from Makkah]. But they plan, and Allah plans. And Allah is the best of planners." (Quran 8:30)

The classical biographies say they agreed that young men from several clans would strike together. On the chosen night, 'Ali ibn Abi Talib (may Allah be pleased with him) lay in the Prophet's bed so that watchers would think he was still at home. 'Ali also stayed behind to return items that people of Makkah had left in the Prophet's trust, a striking detail: even his enemies trusted him with their valuables.

The Prophet ﷺ went to the house of Abu Bakr (may Allah be pleased with him), who had prepared two camels and had been hoping to be his companion. They left by night and headed south, the opposite direction from Madinah, to confuse anyone who followed.

The cave of Thawr: "Allah is with us"

The two travellers hid for three nights in a cave on Mount Thawr, south of Makkah. Quraysh offered a large reward for their capture, and search parties came close to the cave mouth. Abu Bakr later described the moment: "I said to the Prophet (ﷺ) while I was in the Cave. 'If any of them should look under his feet, he would see us.' He said, 'O Abu Bakr! What do you think of two (persons) the third of whom is Allah?'" (Sahih al-Bukhari, no. 3497 (Masaajidh edition).)

The Quran preserves the same scene:

إِلَّا تَنصُرُوهُ فَقَدْ نَصَرَهُ ٱللَّهُ إِذْ أَخْرَجَهُ ٱلَّذِينَ كَفَرُوا۟ ثَانِىَ ٱثْنَيْنِ إِذْ هُمَا فِى ٱلْغَارِ إِذْ يَقُولُ لِصَٰحِبِهِۦ لَا تَحْزَنْ إِنَّ ٱللَّهَ مَعَنَا ۖ فَأَنزَلَ ٱللَّهُ سَكِينَتَهُۥ عَلَيْهِ وَأَيَّدَهُۥ بِجُنُودٍۢ لَّمْ تَرَوْهَا

"If you do not aid the Prophet - Allah has already aided him when those who disbelieved had driven him out [of Makkah] as one of two, when they were in the cave and he said to his companion, 'Do not grieve; indeed Allah is with us.' And Allah sent down his tranquillity upon him and supported him with angels you did not see…" (Quran 9:40)

Read the full verse on Quran.com. Trust in Allah went hand in hand with careful preparation:

  • 'Abdullah ibn Abi Bakr spent the days in Makkah listening for news and brought it to the cave at night.
  • Asma' bint Abi Bakr carried food. She tore her waistband in two to tie the provisions, which is why she was called "the one with the two waistbands" (Dhat an-Nitaqayn).
  • 'Amir ibn Fuhayrah, a freed slave of Abu Bakr, grazed sheep over their tracks and brought milk.
  • 'Abdullah ibn Urayqit, a hired guide who was not a Muslim, led them by a little-used coastal route once the search died down.

Popular retellings add a spider's web and a nesting dove at the cave mouth. These come from later reports whose chains hadith scholars debate, so tell them as stories that are reported, not as established fact.

The journey and Suraqah's chase

After the three nights, the group set out along the Red Sea coast. On the way, a horseman named Suraqah ibn Malik, hoping for the Quraysh reward, caught up with them. In his own account, Quraysh had promised a reward equal to the blood-money for each of them. His horse stumbled, then its forelegs sank into the ground, and he realised "the cause of Allah's Messenger (ﷺ) (i.e. Islam) will become victorious." (Sahih al-Bukhari, no. 3743 (Masaajidh edition).) He turned back and steered other pursuers away, and accepted Islam years later. The whole journey of roughly 450 km took about two weeks.

Arrival in Quba and Madinah

The people of Yathrib waited each morning at the edge of town until the heat drove them home, and when he finally came the welcome was joyful. Most biographies place his arrival at Quba, just outside the town, in Rabi' al-Awwal of the first year (around September 622 CE); the exact day differs between sources.

Three things happened in the first weeks that shaped everything that followed:

  1. The mosque of Quba. He founded the first mosque built in Islam during his stay at Quba (sources differ on how many days).
  2. The Prophet's Mosque. In Madinah, his camel knelt on a plot of land belonging to two orphans. The land was bought and the Prophet's Mosque was built there, with the Prophet ﷺ carrying bricks himself. Meanwhile he stayed with Abu Ayyub al-Ansari.
  3. Brotherhood. Each emigrant from Makkah (the Muhajirun) was paired with a Madinan host (the Ansar, the Helpers). Many Ansar offered to share their homes, land and wealth.

The Quran praises the Ansar for exactly this generosity:

وَٱلَّذِينَ تَبَوَّءُو ٱلدَّارَ وَٱلْإِيمَٰنَ مِن قَبْلِهِمْ يُحِبُّونَ مَنْ هَاجَرَ إِلَيْهِمْ وَلَا يَجِدُونَ فِى صُدُورِهِمْ حَاجَةًۭ مِّمَّآ أُوتُوا۟ وَيُؤْثِرُونَ عَلَىٰٓ أَنفُسِهِمْ وَلَوْ كَانَ بِهِمْ خَصَاصَةٌۭ

"…They love those who emigrated to them and find not any want in their breasts of what the emigrants were given but give [them] preference over themselves, even though they are in privation…" (Quran 59:9)

The town became known as al-Madinah, the City. A written agreement, often called the Constitution of Madinah, set out the rights and duties of its Muslim, Jewish and other residents. Two years later, the young community faced its first great test at the Battle of Badr (2 AH).

How the migration started the Hijri calendar

Ibn 'Abbas summarised the two halves of the Prophet's mission: "Allah's Messenger (ﷺ) started receiving the Divine Inspiration at the age of forty. Then he stayed in Mecca for thirteen years, receiving the Divine Revelation. Then he was ordered to migrate and he lived as an Emigrant for ten years and then died at the age of sixty-three (years)." (Sahih al-Bukhari, no. 3739 (Masaajidh edition).)

The calendar itself came later. During the caliphate of 'Umar ibn al-Khattab (may Allah be pleased with him), around 17 AH (about 638 CE), the need for a common dating system for letters and records became pressing. After consultation, the companions chose the year of the migration as year one. They kept Muharram, already the first month of the Arab year, as the start, so 1 AH began a couple of months before the Prophet ﷺ actually reached Madinah (mid-July 622 CE by the usual conversion).

QuestionAnswer
Year of the migration622 CE (1 AH)
Hiding placeCave on Mount Thawr, three nights
CompanionAbu Bakr as-Siddiq
ArrivalQuba, Rabi' al-Awwal 1 AH (about September 622); exact day differs in sources
Calendar adoptedUnder 'Umar, around 17 AH / 638 CE
First month of the Hijri yearMuharram

The lunar Hijri year is about eleven days shorter than the solar year. Our guide to the Islamic calendar and Hijri months explains how dates are set and why moon sighting matters.

Lessons from the Hijrah for families today

  • Trust and planning together. The Prophet ﷺ relied on Allah completely, yet he planned the route, the food and the guide.
  • Young people matter. 'Ali, 'Abdullah and Asma' were young, and each had a vital job.
  • Welcome the newcomer. The Ansar model how a community should receive migrants.

To teach children, retell the Hijrah over five evenings (the plot, the cave, the chase, the arrival, the brotherhood) and ask one question each night, such as "Who carried the food?"

Conclusion

The Hijrah was a turning point: from persecution to community, from preaching in secret to building a society around the mosque. It is remembered every year at the start of the Hijri calendar, and its lessons of trust, planning, loyalty and generosity are still fresh. To place it in the wider story, from the Prophet's birth to his passing, explore our Seerah timeline and mindmap, or read the early biographies in our classical history texts.

Keep learning:

  • The Seerah: A Timeline of the Life of Prophet Muhammad ﷺ: the whole life in order, from birth to the Farewell Hajj.
  • The Battle of Badr (2 AH): What Happened and Why It Matters: the first major test after the migration.
  • The Mughal Empire: A Short History (1526-1857): a much later chapter of Islamic history, for readers following the story of Muslim civilisation forward.

Frequently asked questions

What is the Hijrah in Islam?

The Hijrah is the migration of Prophet Muhammad and his companions from Makkah to Madinah in 622 CE, after years of persecution. The people of Madinah had pledged to protect him at Aqabah. The migration turned the Muslims into a community with a mosque and a city of their own, and its year became year one of the Islamic calendar.

When did the Hijrah happen?

It happened in 622 CE. Most biographies place the Prophet's arrival at Quba in Rabi' al-Awwal of that year, around September 622, although the exact day differs between sources. The Hijri calendar counts from the start of that lunar year, 1 Muharram, which fell in mid-July 622 by the usual conversion.

How long did the Prophet stay in the cave of Thawr?

He and Abu Bakr stayed three nights in the cave on Mount Thawr, south of Makkah, while Quraysh search parties looked for them. Abdullah ibn Abi Bakr brought news, Asma bint Abi Bakr brought food and Amir ibn Fuhayrah covered their tracks with his sheep. Quran 9:40 describes the moment the Prophet told Abu Bakr not to grieve because Allah was with them.

Who started the Hijri calendar?

The calendar was adopted during the caliphate of Umar ibn al-Khattab, around 17 AH or 638 CE, after he consulted the companions about a common dating system for letters and records. They chose the year of the migration as year one and kept Muharram as the first month. It is a lunar calendar, about eleven days shorter than the solar year.

Is the spider web story at the cave authentic?

The spider web and the nesting dove appear in some later reports, and hadith scholars debate the strength of their chains. It is better to tell them as stories that are reported rather than as established fact. What is firmly established is the Quranic account in Surah at-Tawbah 9:40 and the hadith in Sahih al-Bukhari about the two in the cave whose third is Allah.

#seerah#hijrah#madinah#islamic calendar#abu bakr

Share this article

Masaajidh Editorial Team

Masaajidh Editorial Team

Masaajidh Editorial Team contributes to the Masaajidh Islamic Knowledge Blog.

Related Articles

The Seerah: A Timeline of the Life of Prophet Muhammad ﷺ

The Seerah: A Timeline of the Life of Prophet Muhammad ﷺ

The life of Prophet Muhammad ﷺ in order, from his birth in Makkah to his passing in 11 AH, with Hijri and CE dates, sources, and how the caliphates followed.

Read More
Al-Andalus: Muslim Spain From 711 to 1492

Al-Andalus: Muslim Spain From 711 to 1492

Nearly eight centuries of Muslim Spain: from Tariq ibn Ziyad in 711 to the surrender of Granada in 1492, with its scholars, buildings and lasting legacy.

Read More