A huge stampede killed at least 717 people and injured hundreds more at the hajj in Saudi Arabia on Thursday, in one of the worst-ever tragedies at the annual Muslim pilgrimage.

The stampede, the second deadly accident to hit the pilgrims this month following a crane collapse in Mecca, broke out during the symbolic stoning of the devil ritual, the Saudi civil defence service said.

Bodies of pilgrims wearing traditional white clothing were left scattered by the crush, surrounded by discarded shoes, flattened water bottles and umbrellas that had been used for protection from the sun.

The civil defence service said that it was still counting the dead, who included pilgrims from different countries, and that at least 863 people had also been hurt.

Nearly two million people from across the globe were attending the hajj, one of the largest annual gatherings in the world.

Iran said at least 43 of its citizens were dead and accused Saudi Arabia of safety errors that caused the accident.

stampede
Pilgrims seen lying on stretchers following the incident at Mina. - Pic courtesy of Saudi National Defence

But a Saudi minister blamed the pilgrims themselves, saying they had not followed the rules laid out by authorities.

"Many pilgrims move without respecting the timetables" set for the hajj, Health Minister Khaled al-Falih told El-Ekhbariya television.

"If the pilgrims had followed instructions, this type of accident could have been avoided," he said, vowing a "rapid and transparent" investigation.

'Tripping all over each other'

The stampede began at around 9:00 am (0600 GMT), shortly after the civil defence service said on Twitter it was dealing with a "crowding" incident in Mina, about five kilometres (three miles) from Mecca.

Hundreds of thousands of pilgrims had converged on Mina on Thursday to throw pebbles at one of three walls representing Satan, for the last major ritual of the hajj which officially ends on Sunday.

A hospital official told AFP the incident happened outside the Jamarat Bridge structure, where the stoning takes place. A group of pilgrims leaving the area collided with another group that was either moving in the opposite direction or camped outside, the official said.

A Sudanese pilgrim in Mina said this year's hajj was the most poorly organised of four he had attended.

"People were already dehydrated and fainting" before the stampede, said the pilgrim who declined to be named.

People "were tripping all over each other", he said, adding that a Saudi companion had warned him that "something was going to happen".

Helicopters were flying overhead and ambulances were rushing the injured to hospital, AFP reporters at the scene said.

At one hospital, a steady stream of ambulances discharged pilgrims on stretchers.

The incident came as the world's 1.5 billion Muslims marked Eid al-Adha, the Feast of Sacrifice, the most important holiday on the Islamic calendar.

2 million pilgrims

It was the second major accident this year for hajj pilgrims, after a construction crane collapsed on September 11 at Mecca's Grand Mosque, Islam's holiest site, killing 109 people including many foreigners.

The hajj is among the five pillars of Islam, and every capable Muslim must perform it at least once in a lifetime.

For years the pilgrimage was marred by stampedes and fires, but it had been largely incident-free for nearly a decade following safety improvements.

In the last major incident in January 2006, 364 pilgrims were killed in a stampede during the stoning ritual.

In 1990, a huge stampede in a tunnel at Mina after a ventilation system failure killed 1,426 pilgrims, mainly from Asia.

Thursday's tragedy occurred outside the five-storey Jamarat Bridge, which was erected in the last decade at a cost of more than $1 billion and intended to improve safety during the pilgrimage.

Almost one kilometre (less than a mile) long, it resembles a parking garage and allows 300,000 pilgrims an hour to carry out the ritual.

Official figures released Thursday said 1,952,817 pilgrims had performed this year's hajj, including almost 1.4 million foreigners.

Foreign embassies were working to identify and assist their citizens caught up in the stampede.

READ: Mina stampede: What we know so far?

In Tehran, Saudi Arabia's Shiite rival Iran said authorities at the hajj had closed off two paths near where the accident later took place.

"This caused this tragic incident," the head of Iran's hajj organisation, Said Ohadi, told Iranian state television.

Iranian accusations

"Today's incident shows mismanagement and lack of serious attention to the safety of pilgrims. There is no other explanation. The Saudi officials should be held accountable," he said.

After saying the kingdom was responsible for the tragedy, Iran's deputy foreign minister Hossein Amir Abdollahian said Riyadh's envoy to Tehran would be summoned to the foreign ministry.

The faithful had gathered until dawn Thursday at nearby Muzdalifah where they chose their pebbles and stored them in empty water bottles.

They had spent a day of prayer Wednesday on a vast plain and Mount Arafat, a rocky hill about 10 kilometres (six miles) from Mina, for the peak of the hajj.

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 Ishmael.

At the last moment, God spares the boy, sending a sheep to be sacrificed in his place.

The world's Muslims commemorated Abraham's willingness to sacrifice his son by slaughtering cows, sheep and other animals on Thursday.

Celebrations of Eid al-Adha were also marred in neighbouring Yemen, where a suicide bomber struck a mosque in the capital Sanaa in an attack targeting Shiite worshippers that killed at least 25 people and wounded dozens during prayers.

The attack was claimed by the Islamic State (IS) militant group, which has carried out a string of bombings in recent months targeting Shiites.

PHOTO GALLERY: Stampede in Mina