More than two million Muslim have been performing the final rites of the annual hajj pilgrimage in Saudi Arabia.

Today is Eid al-Adha, the second of the two Eid holidays, when Muslims commemorate the testing of the prophet Ibrahim’s faith.

Hundreds of thousands of pilgrims gathered at an enormous complex in Mina, just outside Mecca, to cast stones at three stone pillars that mark the spot where it is believed the devil tried to talk Ibrahim out of submitting himself to the will of God.

Hajj 2017 Show all 16 1 /16 Hajj 2017 Hajj 2017 A Muslim pilgrim partakes in the symbolic stoning of the devil at the Jamarat Bridge in Mina, near Mecca, which marks the final major rite of the hajj Karim Sahib/AFP Hajj 2017 Muslim pilgrims take part in the symbolic stoning of the devil at the Jamarat Bridge in Mina, near Mecca, which marks the final major rite of the hajj Karim Sahib/AFP Hajj 2017 A Muslim pilgrim partakes in the symbolic stoning of the devil at the Jamarat Bridge in Mina Karim Sahib/AFP Hajj 2017 A Muslim pilgrim has his head shaven after throwing pebbles at pillars during the symbolic stoning of the devil Karim Sahib/AFP Hajj 2017 A Muslim pilgrim's head is shaved, after throwing pebbles at pillars during the symbolic stoning of the devil Karim Sahib/AFP Hajj 2017 A Saudi policeman spays Muslim pilgrims with water to cool them off near the Grand Mosque Karim Sahib/AFP Hajj 2017 Muslim pilgrims pray at Mount Arafat, southeast of the Saudi holy city of Mecca Bandar Aldandani/AFP Hajj 2017 Muslim pilgrims at the Grand Mosque Karim Sahib/AFP Hajj 2017 Iranian Muslim pilgrims wait at Jeddah airport in Saudi Arabia prior to the start of the annual Hajj pilgrimage in the holy city of Mecca Karim Sahib/AFP Hajj 2017 Muslim worshippers perform prayers around the Kaaba, Islam's holiest shrine, at the Grand Mosque in Saudi Arabia's holy city of Mecca Karim Sahib/AFP Hajj 2017 An Iranian Muslim pilgrim reads the Koran as she waits at Jeddah airport in Saudi Arabia, prior to the start of the annual Hajj pilgrimage in the holy city of Mecca Karim Sahib/AFP Hajj 2017 Saudi Red Crescent paramedics show the press their emergency equipment Karim Sahib/AFP Hajj 2017 Muslim worshippers perform prayers around the Kaaba, Islam's holiest shrine, at the Grand Mosque in Saudi Arabia's holy city of Mecca Karim Sahib/AFP Hajj 2017 Muslim worshippers perform prayers around the Kaaba, Islam's holiest shrine, at the Grand Mosque in Saudi Arabia's holy city of Mecca Karim Sahib/AFP Hajj 2017 Muslim worshippers walk around the Kaaba, Islam's holiest shrine, at the Grand Mosque in Saudi Arabia's holy city of Mecca Karim Sahib/AFP Hajj 2017 Muslim pilgrims sit around the Kaaba, the cubic building at the Grand Mosque, ahead of the annual Hajj pilgrimage in the Muslim holy city of Mecca Karim Sahib/AFP

In the Koran, Ibrahim’s faith was tested when God commanded him to kill his son Ismail, only to stay his hand at the last minute.

In the Christian and Jewish version of the story, the prophet known as Abraham is ordered to kill his other son, Isaac.

On the Eid al-Adha holiday, or ‘feast of sacrifice', Muslims slaughter lifestock and donate the meat to the poor.

For the last three days of hajj, pilgrims sleep in a tent city in Mina with capacity for three million people to take part in the symbolic stoning of the devil.

This was the location of a tragic stampede in 2015, when more than 2,500 people were killed after two crowds collided.

The Saudi government has since widened roads in and around Mina to increase capacity, and this year has laid on more than 100,000 security forces to manage the crowd.

Most pilgrims will remain in Mina until Monday before completing the hajj by circling the cube-shaped Kaaba in Mecca, Islam's most sacred site.

The Kaaba represents the house of God and the unity of God in Islam. It is what observant Muslims face five times a day when they pray.