Every year hundreds of people die in stampede during the ritual stoning of the pillars at the annual Hajj pilgrimage.

In 2006, 362 people died in the crush at Mina, where pilgrims gathered to perform the ritual. However, this year's ritual, which happened in late December and early January, went off without any incident.

So what was it, pure luck? Certainly not; according to Dirk Helbing of the Dresden University of Technology, Germany, it was sound planning based on the study of crowd dynamics that helped prevent casualties during one of Islam's most holiest traditions.

The activity in Mina, about four miles from Mecca, centres on the ritual stoning of three pillars representing the devil. The activity, known as the jamarat draws huge crowds.

To ease congestion problems, Saudi authorities replaced the old pillars with larger, elliptical ones and constructed a building called the Jamarat Bridge that provides pilgrims two tiers of access to the jamarat.

However, even these precautions proved ineffective owing to the steady increase in the number of pilgrims over the years.

Last year, the Saudi government contacted Helbing and his colleague on how to improve crowd safety.

The research team was allowed to analyse video recordings of the crowd at Mina.

Helbing and his co-workers had previously analysed how people moved past each other in corridors or intersections, and how jams occur when many people try to exit quickly through one single door.

"The Saudis invested a lot of money in putting up cameras to gather data," he said.

The team used computer simulation and found that as the melee thickened, the throng stopped passing steadily onto the bridge and instead moved in waves, so that individuals would be repeatedly stopping and starting.

Then, as the crowd became even denser, it changed to another mode in which clumps of people were jostled in all directions, apparently at random and against their wish to move steadily towards the jamarat.

"Pilgrims were being pushed around and if they stumbled and didn't get back on their feet quickly enough, they were trampled. The movements look like those in a fluid when it becomes turbulent, which hasn't been seen before in human motion," he said.

However, pilgrims directed along one-way routes could safely follow the flow, avoiding dangerous crush points, he said.

According to Helbing there are warning signs for the development of this type of behaviour.

For any given point on the route, the average number of people passing per minute falls below a critical threshold up to half an hour before turbulence sets in, Nature quoted him as saying.

Armed with the findings, Helbing consulted with the Saudi authorities for a new route and schedule that pilgrims would be compelled to follow, rather than meandering at will to the jamarat.

Multiple entry points were introduced at the Jamarat Bridge to synchronize the crowd flow.

"All 1.5 million registered pilgrims got a timetable and a route in order to distribute them uniformly in space and time. In case the more-than-a-million unregistered participants confounded this plan, they also had the capacity to use real-time data from surveillance cameras to alter the schedule, guided by the models of crowd behaviour. That capacity wasn't needed this year, but the scheme is in place for future," he said.

"This Hajj, in contrast to many previous ones, was very safe, without any panics or incidents, even though it was expected to be the most critical ever and there were about 800,000 more pilgrims than the expected three million. This great success was due to a completely different organization of pilgrim flows.

"Most of the critical organizational measures are now in place, so that future years should be safer. From next year on, the Jamarat Bridge will have more floors, easing the flow even more. Now other experts can take over," he added.

"The science was very important. We learnt a lot about how to organize the flow from the crowd simulations," said Salim Al Bosta, a civil engineer at the Saudi Ministry of Municipal and Rural Affairs in Riyadh, who managed the consultation exercise.

The findings appear in a paper on the arXiv preprint server. (ANI)