Two million Muslims ritually stoned the devil Saturday in the last major rite of this year's hajj in Saudi Arabia, while fellow believers around the world celebrated Eid al-Adha, the feast of sacrifice.
The stoning occurred in Mina, about five kilometres (three miles) east of the Grand Mosque in the holy city of Mecca.
All roads leading to Mina, a city that only comes to life during the days of hajj, were blocked as the crowds dressed in white flowed into the area.
They crowded into a five-storey structure that resembles a parking garage, and from there tossed pebbles at one of three walls representing Satan.
As pilgrims tried to push forward, security officers formed a human chain around part of the wall where space had been left for the elderly and disabled.
The heat and the crowds only added to "the joy of carrying out the rites", Mohsen al-Omar, a Jordanian resident of Saudi Arabia, said with sweat running down his face.
The pilgrims, who collected the pebbles at Muzdalifah on the way to Mina, will stone two other sites on Sunday and Monday as the hajj concludes.
The ritual emulates the prophet Abraham, who is said to have stoned the devil at three locations when he tried to dissuade Abraham from God's order to sacrifice his son.
At the last moment, God spares the boy, sending a sheep to be sacrificed in his place.
Pilgrims reached Mina overnight following a day of prayer on Mount Arafat, where the Prophet Mohammed is believed to have given his final sermon 14 centuries ago.
After their day on the vast plain of Arafat and the hill that bears its name, the believers' white costumes bore brown dirt stains.
Male pilgrims wear a seamless two-piece white "ihram," while women also generally wear white.
With the hajj concluding, men shaved their heads before taking off their ihrams, leaving locks scattered on the ground. Women cut off small strands of their hair.
In conjunction with the stoning, the hajj faithful offer sacrifices by slaughtering a sheep, whose meat goes to the needy.
- A worldwide celebration -
Signup to our newsletter and follow us on Facebook and Twitter!
Nowadays pilgrims do not carry out this rite themselves, but pay agencies that distribute the meat to Muslims in many countries.
A total of about 1.5 billion Muslims around the world were also celebrating Eid al-Adha.
From Lagos to Kabul, Manila to Moscow, Muslims took part in events to commemorate Abraham's readiness to sacrifice his son.
Goats, sheep and cows were slaughtered and prayers were said at mosques and in parks.
In the Palestinian territories and Israel, Muslims and Jews marked holy days within a short distance of each other. Eid coincides for the first time in three decades with the solemn Jewish fast of Yom Kippur.
Hundreds gathered for prayers in front of the flashpoint Al-Aqsa mosque compound in east Jerusalem, amid a security lockdown.
This year's hajj attracted just over two million domestic and foreign believers, including almost 1.4 million from abroad, according to the official Saudi Press Agency (SPA).
These numbers are roughly the same as last year.
The hajj has drawn a cross-section of humanity from presidents -- Sudanese leader Omar al-Bashir was among them -- to commoners including a wounded Syrian rebel war veteran.
The world's largest Muslim gathering officially ends on Tuesday.
It is one of the five pillars of Islam, and every capable Muslim must perform it at least once in what is the high-point of his or her spiritual life.
Despite improved organisation, Pakistani engineer Mohammed Khan, 29, complained that there is still a lack of basics such as "water and shaded areas" to protect people from the desert sun.
Saudi authorities have spent billions of dollars on safety projects for the hajj, which has been almost incident-free in recent years after earlier stampedes and fires.
They have invested in everything from cooling water sprays to a train for moving the pilgrims, and Hajj Minister Bandar bin Mohammed Hajjar said the kingdom aims to ensure pilgrims perform their rituals "in ease and comfort".
No cases of the deadly MERS or Ebola viruses have been recorded among the pilgrims, a health ministry official was quoted by SPA Saturday as saying.