A week ago, on Jan. 5, a building being used as a pilgrims' hotel collapsed, killing 76 people in Mecca.
In the ritual, all the pilgrims must pass ''pillars" called al-Jamarat, which represent the devil and which the faithful pelt with stones to purge themselves of sin.
The site in the desert of Mina, just outside the holy city of Mecca, is a bottleneck in the weeklong pilgrimage and has seen deadly events in seven of the past 17 years, including a stampede in 1990.
In the 1990 disaster, 1,426 people were killed. In 2004, another stampede left 244 pilgrims dead.
''I heard screaming and . . . saw people jumping over each other," Suad Abu Hamada, an Egyptian pilgrim, said of the disaster yesterday. ''Police started pulling out bodies. The bodies were piled up. I couldn't count them; they were too many."
Bodies covered in white sheets lined the pavement near the ramp where the stampede occurred, and emergency workers rushed the injured away on stretchers.
Police cleared part of the site, but thousands of pilgrims continued the stoning ritual.
The Interior Ministry put the death toll at 345, and the Health Ministry said 289 people were injured. State-run Al-Ekhbariyah television said most of the victims were from South Asia.
After the 2004 stampede, Saudi officials widened ramps leading to a platform the width of an eight-lane highway where the pillars are located. They also created more emergency exits.
The pillars were replaced with 85-foot-long walls to allow more people to stone them at once, without jostling one another.
In addition, the walls were extended through the bottom of the platform so more pilgrims could carry out the stoning from below.
The stampede occurred below the platform, near one of the four big ramps. In theory, the crowds are supposed to enter the platform using two of the ramps and exit down the other two, but pilgrims often are not aware of, or ignore, the rules.
Thousands of pilgrims were rushing to complete the last of the three days of the stoning ritual before sunset, when some began to trip over dropped baggage, said Major General Mansour al-Turki, spokesman for the Interior Ministry.