BEIRUT, Lebanon — In streaming ribbons of white, great masses of Muslim pilgrims made their way between cities of air-conditioned tents toward the next stop on their holy tour of Mecca in Saudi Arabia.

Then something went disastrously wrong, trapping the crowds in narrow streets and touching off a mass panic and crushing stampede that left the asphalt covered with lost sandals, crumpled wheelchairs and piles of white-robed bodies.

It was the deadliest accident during the hajj pilgrimage in a quarter-century, with at least 717 pilgrims from around the world killed and more than 850 injured. And it posed yet another challenge for the country’s new leader, King Salman, who is already coping with low oil prices, a war in Yemen and an increasingly fierce rivalry with Iran.

The stampede was the latest in a series of crises that have plagued the pilgrimage this season: Just two weeks ago, a crane collapse killed more than 100 visitors, and hotel fires have injured others. The missteps have embarrassed the insular Saudi monarchy, which considers itself the global guardian of orthodox Islam and takes great pride in protecting the holy sites and their millions of annual visitors.

King Salman — who bears the title of “the custodian of the two holy mosques,” giving him personal responsibility for Mecca and Medina — expressed his condolences for the dead in an address that aired on Saudi state television and ordered a review of the management of the pilgrimage. A commission was formed to investigate.

Other officials appeared to blame the dead. The Saudi health minister, Khalid al-Falih, said in a statement that the stampede may have been caused by “some pilgrims who didn’t follow the guidelines and instructions issued by the responsible authorities.”

But some present in the area at the time said security forces had temporarily closed exits from an area packed with pilgrims, causing the crowding that led to the stampede.

Khalid Saleh, a Saudi government employee who rushed to the site when he heard screams and sirens, said he had found “huge numbers of people on the ground either dying or injured.” Pilgrims there told him that some of the area’s exits had been closed so that V.I.P. cars could pass, he said.