The ritual is an emulation of Abraham's stoning of the devil at the three spots where it is said Satan tried to dissuade him from obeying God's order to sacrifice his son, Ishmael.
After the first stoning, the Eid al-Adha feast of sacrifice begins, marking the end of the hajj.
The pilgrims can then change back into normal clothing, returning to circumambulate the Kaaba and complete their stone-throwing rituals before heading home.