SEERAH

The Hijrah Explained: Why the Migration to Madinah Changed History

What the Hijrah was, why the Prophet ﷺ left Makkah for Madinah in 622 CE, what happened on the journey, and why the Islamic calendar starts from it.

By 10 min read

White minarets of a mosque in Madinah rising behind date palms at dusk
"Madinah 6" by Khawaja Umer Farooq, CC BY-SA 4.0, via Wikimedia Commons

The Hijrah is the migration of the Prophet Muhammad ﷺ and the early Muslims from Makkah to Madinah (then called Yathrib) in 622 CE. It turned a persecuted minority into a community with its own city, mosque and agreements, and it became year one of the Islamic calendar. Every Hijri new year, which falls in mid-June in 2026, points back to this journey.

This guide explains why the migration happened, what happened on the road, and why Muslims still treat it as a turning point. Religious claims link to the Quran on Quran.com and to hadith on Sunnah.com, so you can read each source yourself.

Key Takeaways

  • The Hijrah (Arabic for "migration") was the Prophet's ﷺ move from Makkah to Madinah in 622 CE, after years of persecution and a plot against his life (Quran 8:30).
  • He and Abu Bakr hid for three nights in the cave of Thawr before taking a coastal route north (Sahih al-Bukhari 3905).
  • The companions dated the Islamic calendar from the Prophet's arrival in Madinah, not from the start of his prophethood or his death (Sahih al-Bukhari 3934).
  • In Madinah the Muslims built a mosque, paired emigrants with local helpers, and formed the first Muslim community with its own public life.

What Does "Hijrah" Mean?

Hijrah (هجرة) means "migration" or "leaving" in Arabic. In Islamic history it refers above all to the Prophet's ﷺ migration to Madinah in 622 CE. The people who migrated are called the Muhajirun (emigrants), and the Muslims of Madinah who took them in are called the Ansar (helpers). The Quran praises both groups together in Surah At-Tawbah 9:100.

The word also carries a moral meaning. The first hadith in Sahih al-Bukhari uses migration as its example: a person's reward depends on their intention, so whoever migrated for worldly gain or to marry someone has migrated for that, and not for Allah (Sahih al-Bukhari 1). The Hijrah was a real journey, but Muslims also read it as a lesson about why you do what you do.

Why Did the Prophet ﷺ Leave Makkah?

The Prophet ﷺ left Makkah because his message faced growing hostility there, and because a safe home had opened up in Yathrib. After more than a decade of preaching, many of the Quraysh leaders had turned openly hostile, and believers were "put to test" for their faith (Sahih al-Bukhari 3905).

Persecution and an earlier migration

Before the Hijrah to Madinah, some Muslims had already fled to Abyssinia (Ethiopia) to escape persecution. Aisha's long account of the Hijrah opens with her father, Abu Bakr, setting out for Abyssinia after the Muslims "were put to test", and returning only under the protection of a local chief (Sahih al-Bukhari 3905). Abu Bakr later gave up that protection rather than stop reciting the Quran openly outside his house, saying he was "pleased with the protection from Allah".

The pledges of Aqabah

The door to Madinah opened through pledges made by people from Yathrib at Aqabah, near Makkah, during the pilgrimage season. Ubadah ibn as-Samit, one of the leaders who took part, describes the pledge: not to worship anything besides Allah, not to steal, not to commit adultery, not to kill their children and not to slander (Sahih al-Bukhari 3892). These meetings opened the way for the people of Yathrib to invite the Prophet ﷺ and his followers to live among them.

A plot against his life

The Quran itself records what the Quraysh planned: "when those who disbelieved plotted against you to restrain you or kill you or evict you" (Surah Al-Anfal 8:30, Sahih International translation). Aisha's narration adds that the Prophet ﷺ was shown in a dream "a land of date palm trees, between two mountains", and many companions began leaving for Madinah while he waited for permission to go (Sahih al-Bukhari 3905).

What Happened on the Journey to Madinah?

The journey began in secret, included three nights hiding in a cave and ended with a crowd waiting in the heat to welcome the Prophet ﷺ. The main account comes from Aisha, Abu Bakr's daughter, preserved in Sahih al-Bukhari.

Stage What happened Source
Permission The Prophet ﷺ came to Abu Bakr's house at midday and told him, "I have been given permission to migrate." Bukhari 3905
Preparation Asma bint Abi Bakr tied the food bag with part of her belt, earning the name Dhat an-Nitaqayn ("she of the two belts"). Bukhari 3905
The cave of Thawr The two men hid for three nights. Abdullah ibn Abi Bakr brought news from Makkah each night, and Amir ibn Fuhayrah grazed sheep nearby to supply milk. Bukhari 3905
The guide They hired an expert guide from the tribe of Bani ad-Dil, who was not a Muslim, and he led them along the coast. Bukhari 3905
The pursuit Suraqa ibn Malik ibn Ju'shum chased them for the bounty, but his horse's legs sank into the ground; he asked for a written promise of safety instead. Bukhari 3906
Arrival They reached the quarter of Bani Amr ibn Awf at Quba on a Monday in the month of Rabi al-Awwal. Bukhari 3906

"Allah is with us": the moment in the cave

The best-known moment of the Hijrah happened in the cave. Abu Bakr later recalled whispering, "If any of them should look under his feet, he would see us." The Prophet ﷺ replied, "O Abu Bakr! What do you think of two, the third of whom is Allah?" (Sahih al-Bukhari 3653).

The Quran refers to the same scene: "as one of two, when they were in the cave and he said to his companion, 'Do not grieve; indeed Allah is with us'" (Surah At-Tawbah 9:40, Sahih International translation). For many Muslims this verse is the heart of the Hijrah story. If you are learning the stories of the earlier prophets too, the Prophets quiz covers other moments of trust under pressure.

A journey that relied on many people

The Hijrah was not a two-person escape. Asma packed food, her brother Abdullah gathered news, Amir ibn Fuhayrah brought his flock each night so they had fresh milk, and a paid guide who did not share their faith showed the way (Sahih al-Bukhari 3905). Even Suraqa, who set out to capture them, ended up passing on the Quraysh's plans and agreeing to keep quiet (Sahih al-Bukhari 3906). Each person had a defined role, and the plan depended on all of them keeping a secret.

How Was the Prophet ﷺ Welcomed in Madinah?

The people of Madinah gave the Prophet ﷺ one of the warmest welcomes in the Seerah. Al-Bara ibn Azib, who lived there, said: "I had never seen the people of Medina so joyful as they were on the arrival of Allah's Messenger" (Sahih al-Bukhari 3925).

Urwah ibn az-Zubair reports that the Muslims of Madinah had been walking out to the lava field (the Harra) every morning to wait for him, going home only when the noon heat forced them. The first person to spot the travellers was a Jewish man standing on a fort roof, who called out to the Arabs that the man they were waiting for had arrived (Sahih al-Bukhari 3906).

The first mosques

The Prophet ﷺ stayed with Bani Amr ibn Awf at Quba and established a mosque there before moving into the town (Sahih al-Bukhari 3906); another narration puts his stay at fourteen nights (Sahih al-Bukhari 3932). The Quran mentions "a mosque founded on righteousness from the first day" (Surah At-Tawbah 9:108). Scholars differ on whether this refers to the Mosque of Quba or the Prophet's Mosque in Madinah.

In the town, his camel knelt at a date-drying yard owned by two orphan boys, Sahl and Suhail. They offered it as a gift, the Prophet's Mosque was built there, and he carried bricks for its construction with his own hands (Sahih al-Bukhari 3906).

Why Did the Hijrah Change History?

The Hijrah changed history because it gave the Muslims something they never had in Makkah: a place where they could live, worship and organise openly as a community. Five changes stand out.

  1. A community instead of a persecuted group. In Makkah, Muslims were scattered and vulnerable. In Madinah they formed a society with shared prayer, shared responsibilities and a recognised leader.
  2. Brotherhood across tribes. The Prophet ﷺ paired emigrants with members of the Ansar in a bond of brotherhood. Sa'd ibn ar-Rabi offered Abdur-Rahman ibn Awf half of his wealth; Abdur-Rahman thanked him and asked only to be shown the market (Sahih al-Bukhari 3780). The Quran praises the Ansar because "they love those who emigrated to them" and give others preference over themselves (Surah Al-Hashr 59:9).
  3. A written order for a mixed city. Madinah included Arab tribes and Jewish clans as well as Muslims. The seerah literature records a written agreement, often called the Constitution of Madinah, that set out obligations between these groups. Within the hadith collections, Ali ibn Abi Talib later kept a written document declaring Madinah a sanctuary (Sahih al-Bukhari 1870).
  4. A new name. The Prophet ﷺ described being ordered to migrate to a town "called Yathrib and that is Medina" (Sahih al-Bukhari 1871). The city became known as al-Madinah, "the city".
  5. A new calendar. The companions chose the Prophet's arrival in Madinah as the starting point of their calendar rather than the start of his prophethood or his death (Sahih al-Bukhari 3934). Year 1 of the Hijri calendar (AH, Anno Hegirae) begins with the year of the Hijrah, and the 12 Hijri months are counted from there. You can test yourself on these Madinan milestones in the Seerah quiz.

The Hijrah and the Islamic Calendar

The Islamic calendar counts years from the Hijrah, which is why dates are written with "AH" (after Hijrah). The Hijrah year 622 CE is the standard conversion used in reference works such as the Encyclopaedia Britannica entry on the Hijrah. Sahl ibn Sa'd explains that the companions did not take the start of prophethood or the Prophet's death as their reference point, "but the day of his arrival at Medina" (Sahih al-Bukhari 3934).

In other words, the companions did not date their history from a victory. They dated it from the moment the community was free to live by its faith. The Hijri calendar is lunar, so each year is roughly eleven days shorter than a solar year, and the new year moves through the seasons. Its first month is Muharram, although the Prophet ﷺ arrived in Madinah in Rabi al-Awwal (Sahih al-Bukhari 3906).

Is There Still a Hijrah Today?

The specific Hijrah from Makkah to Madinah ended once Makkah came under Muslim rule. Aisha was asked about migration years later and said, "Today there is no emigration," explaining that believers once fled to protect their faith, but now a believer "can worship his Lord wherever he likes" (Sahih al-Bukhari 3900).

The wider idea remains. Muslims often speak of the inner hijrah: leaving behind habits and sins for something better, with a sincere intention, in the spirit of the first hadith of Bukhari (Sahih al-Bukhari 1). Questions about when a Muslim should physically move for the sake of their faith involve detailed fiqh, so readers facing that decision should ask a qualified scholar.

Frequently Asked Questions

What year was the Hijrah?

The Hijrah took place in 622 CE, which became year 1 of the Islamic (Hijri) calendar. The Prophet ﷺ arrived at Quba on a Monday in the month of Rabi al-Awwal (Sahih al-Bukhari 3906).

Who went with the Prophet ﷺ on the Hijrah?

Abu Bakr as-Siddiq travelled with him. Amir ibn Fuhayrah, Abu Bakr's freed servant, and a hired guide joined them when they left the cave of Thawr (Sahih al-Bukhari 3905). Many companions had already gone ahead to Madinah.

How long did they stay in the cave of Thawr?

They stayed three nights, according to Aisha's account in Sahih al-Bukhari 3905.

Why is it called Madinah?

Its older name was Yathrib. The Prophet ﷺ referred to it as "Yathrib and that is Medina" (Sahih al-Bukhari 1871), and it became known as al-Madinah, meaning "the city".

Test What You Remember

If you want to check what stuck, try a general Islamic quiz and the daily Islamic quiz for a short mixed set. Every answer in the Islamic Trivia question bank links to its reference, and you can browse the Quran and hadith sources we use.

The Hijrah reminds Muslims that faith includes both trust and effort: the Prophet ﷺ planned every step, and still told his companion in the cave, "Indeed Allah is with us."

Sources

Written by Tnas, a Muslim software engineer who writes about Islamic learning. Tnas is not a scholar; for religious questions, consult a qualified teacher. Corrections are welcome at admin@umratech.com.

Learn your deen, one question at a time.

Keep learning in the app

Explore solo levels, a daily question, 1v1 battles and quiz rooms with friends. Download Islamic Trivia on iOS or Android.

Stores list current purchase options. Multiplayer requires internet access and available players.

Sheikh Fūl, the Islamic Trivia learning companion