Millions of Muslims from around the world gather annually in Mecca in anticipation of Hajj - the Muslim pilgrimage, which follows the actions of the Prophet Muhammad 1,377 years ago.

Taking part in the pilgrimage at least once in one's lifetime is a major obligation for all able-bodied Muslims of financial means, and between two and three million people participate in the six-day ritual every year.

Hajj occurs in the 12th month of the Islamic lunar calendar, called Dhul-Hijjah, between the eighth and 13th days of the month.

While the specific rituals carried out by Muslims today date back to the Prophet Muhammad's "farewell pilgrimage" in 632 AD, travelling to Mecca was a sacred annual rite for Arabian tribes centuries before the advent of Islam.

According to Islamic tradition, the Kaaba - a black silk-clad stone structure at the heart of the Grand Mosque in Mecca - was built by the Prophet Abraham in biblical times.

Hajj is, put simply, complex. There are several different ways of performing it, and numerous schools of Islamic thought, between which lie many scholarly differences. Here is a breakdown of the steps included in performing hajj.

Enter ihram (the sacred state)

The very first rite of Hajj is entering ihram - a pilgrim's sacred state - when crossing the outer boundaries of Mecca, called Miqat.

On the eighth of Dhul-Hijjah, pilgrims enter ihram, which entails wearing plain garments - two unstitched cloths for men, or loose-fitting clothing for women - as well as following certain rules, such as not giving in to anger or engaging in sexual activity.

Head to Mina, a sprawling tent city

The pilgrims then set out en masse from Mecca to the sprawling tent-city of Mina, whether by foot along pilgrim paths or by buses and cars. It is an 8 km journey.

The pilgrims will spend the day in Mina, only setting out the next morning at dawn. Most of the time in Mina is spent in prayer and remembering Allah.

Spend the day at Arafat

The Day of Arafat is considered one of the most important days, not just of Hajj, but of the Islamic calendar. Mount Mercy at Arafat was the scene of the Prophet Muhammad's final sermon. After making the 14.4 km journey from Mina, pilgrims spend the day here in reverent prayer.

Elsewhere in the world, many Muslims choose to fast on this day.

Collect pebbles at Muzdalifah

After sunset, its time to move again, this time to Muzdalifah - a 9 km trip - where they spend the night under the stars. Many will also begin collecting pebbles here for tomorrow's rites, departing again just before sunrise.

Throw stones at the pillars

For those performing Hajj, the day is known as yawm-ul hajj al-akbar (The big hajj day) and is probably the longest day of the pilgrimage, and the most dangerous.The 10th of Dhul-Hijjah is Eid al-Adha, a day celebrated by Muslims around the world as the greater of the two Muslim holidays.

Pilgrims start the day in Muzdalifah and begin heading back to Mina before dawn. Once in Mina, they perform the first rami, throwing seven pebbles at the largest of three columns known as Jamarat.

This act is a symbolic stoning of the devil, based on historical tradition. God told Abraham to sacrifice his son, the story goes, as proof of faith. It is believed that at this spot in Mina, the devil appeared and tried to dissuade Abraham from heeding the command. Abraham responded by throwing stones to scare him off.

Millions of pilgrims converge at the Jamarat Bridge, which houses the three columns representing the devil, in order to re-enact the story.

The bridge has been the sight of deadly stampedes in the past, with around 350 people being crushed to death in 2006.

But in recent years, the event has taken place without major incident.

After casting their stones, pilgrims must perform the sacrifice. Completing the story, when Abraham went to sacrifice his son, he found God had placed a ram there to be slaughtered instead.

Pilgrims thus must slaughter a sheep, goat, cow or camel - or more likely, pay for it to be done in their names.

At this point, pilgrims trim or shave (men only) their hair and remove their ihram clothes. Many will then proceed to Mecca to perform tawaf and sa'ee, first circling the Kaaba seven times, then walking seven times between the hills of Safa and Marwa.

When all is finally done, they return to their campsite in Mina.

Final days in Mina

On each day, they will again symbolically stone the devil - this time throwing seven pebbles at each of the three pillars.With the hardest part behind them, pilgrims will now spend the next two or three days in Mina.

When their time in Mina is finished, the pilgrims return to Mecca to perform the final circulation of the Kaaba, a "farewell" tawaf.

Before heading home, many also go to Medina, the second holiest city in Islam, where the Prophet Muhammad is buried along with his closest companions. Visiting Medina, however, is not part of the pilgrimage.