As nearly two million Muslim pilgrims converged on Saudi Arabia’s deserts for the annual hajj, the kingdom was braced for everything from terrorist attacks to demonstrations against Israel’s war in the Gaza Strip .

Instead, the threat came from the heat.

Temperatures soared above 125 degrees Fahrenheit at one point this week—unusually high for mid-June—and more than 1,170 people died. Among them were a number of Americans, a State Department spokesperson said. The situation was worsened by a large number of unpermitted pilgrims who didn’t have access to cooling facilities or the full range of available healthcare.

The death toll is the highest at the hajj since a stampede in 2015 killed more than 2,000 people. The fatalities are still being counted and are likely to rise, as hundreds of people are either missing or in the hospital with severe heat stroke. Hundreds of Egyptians were among the dead.

A satellite image shows an overview of worshipers around the Kaaba at the Grand Mosque during the annual Hajj pilgrimage, in Mecca, Saudi Arabia, June 16, 2024. Maxar Technologies/Handout via REUTERS.

Pilgrims began to succumb to the heat last Saturday, the first day of the event, when worshipers make a trek of nearly 10 miles to climb Mount Arafat then stand outside for hours to pray before returning to Mecca.

Mohamed Kamal, an IT specialist from Cairo, said his 70-year-old father died after going to hajj through an Egyptian tourism company that charged him half the standard cost but brought him to Mecca on an irregular visa three weeks early to skirt Saudi permit requirements.

The bus that was arranged to take him to Arafat on Saturday filled up fast, so he paid $400 for another ride. But the police stopped that bus from transporting unpermitted pilgrims, forcing him to walk for miles.

Kamal last heard from his father eight hours later when he reached Namira Mosque in Arafat for midday prayers; after that, his phone was off. Relatives in Saudi Arabia checked area hospitals but it wasn’t until Tuesday that they learned Kamal’s father had died. His name appeared on an online list of the deceased without indicating a cause.

Kamal said he blamed the tourism company for providing insufficient services and warnings about the hardship the hajj involves. “Most of the pilgrims are elderly and have chronic diseases, and the temperature there is above 50 degrees Celsius,” he said, a level above 120 Fahrenheit. “How can an elderly person endure walking 20 kilometers in the heat and sun?”

Saudi Arabia limits the number of pilgrims from each country. To circumvent the caps and save on the cost of sanctioned travel packages that usually start at several thousand dollars, many people travel to the country as tourists then slip into the hajj rituals.

Unpermitted pilgrims don’t have standard access to official buses or air-conditioned venues, so they ended up making the trek to Arafat and spending all day in the sun, often without enough water or parasols.

In interviews with The Wall Street Journal and video testimonies posted online, some pilgrims said the Saudi police had granted them access to Arafat on Saturday without permits but later didn’t respond to pleas for help when they reported that people had collapsed on the walk. Others said police had distributed food, water and parasols but that ambulances were overwhelmed by the need.

Footage showed multiple bodies lying on the side of a road in Mina, which is on the road between Arafat and Mecca.

Ahmed Mohammed, a 31-year-old Egyptian who attended hajj without a permit, said that as he came down from Arafat he tried to help an older man who was too exhausted to continue. The police and medics told him they had other calls to respond to first, so he pushed the man in a wheelchair for an hour to a private clinic, which refused to admit him. Finally, Mohammed’s cousin was able to get close enough with a car for them to load the man in and take him to a public hospital, where he entered intensive care.

“Most people are walking long distances, and the crowds are immense,” Mohammed said. “The police and ambulance service were overwhelmed with reports that they were not prepared to handle.”

A Jordanian grandmother with arthritis said she felt hounded and harassed by the police because she didn’t have a hajj permit. When the police prevented her group from reaching Arafat, they walked through the desert. “The sand felt like you were walking on coals. People’s feet were burned and became swollen,” she said.

Saudi Arabia hasn’t commented on the death toll and didn’t respond to questions about what happened at this year’s hajj, in which some 1.83 million people participated. It said Monday that more than 2,700 people had been treated for heat stroke. The army had deployed more than 1,600 personnel with medical units specifically for heat stroke and had staffed 30 rapid-response teams. An additional 5,000 health and first-aid volunteers also took part.

Health Minister Fahd Al-Jalajel said Tuesday that health plans had been carried out successfully, with no outbreak of disease or other threats to public health. He said heat-stress injuries had been minimized by discouraging pilgrims from performing rituals during peak temperatures.

Saudi officials have asked pilgrims to stay hydrated and carry umbrellas. They advised pilgrims on Monday against performing the symbolic “stoning of the devil” ritual at midday after temperatures soared, and on Thursday encouraged worshipers to pray at local mosques across Mecca rather than the central mosque to reduce crowding and avoid high temperatures.

Muslim pilgrims gather at Mount of Mercy on the plain of Arafat during the annual haj pilgrimage, outside the holy city of Mecca, Saudi Arabia, June 15, 2024. REUTERS/Saleh Salem 

Muslim pilgrims circle the Kaaba as they perform Tawaf during the annual haj pilgrimage, at the Grand Mosque, in Mecca, Saudi Arabia June 16, 2024. REUTERS/Saleh Salem

The hajj, a five-day event that has been held since the seventh century, is a once-a-lifetime duty for Muslims able to make the journey and is one of the world’s largest annual gatherings. It’s also a source of great political and religious prestige for Saudi Arabia as the custodian of Islam’s two holiest sites and generates billions of dollars in revenue for the kingdom each year.

Safety and security incidents can carry geopolitical risk, fueling calls from Saudi rivals like Iran and Yemen’s Houthi rebels to place Mecca and Medina under international administration.

Ahead of this year’s hajj, the most obvious concern was that Israel’s war against Hamas in Gaza risked sparking unrest among Muslim worshipers, many of whom oppose the Israeli occupation of Palestinian territories as well as Saudi Arabia’s openness to establishing formal relations with Israel in a U.S.-backed deal .

Saudi Arabia has sought to curb the number of unpermitted pilgrims with threats of arrest and fines, even as the kingdom aims to double the official capacity of the hajj to six million by 2030. But the kingdom’s efforts to build a traditional tourism industry have also made it easier for foreigners to enter the country for other purposes and hide out in Mecca waiting for the rituals to begin.

Saudi public-security director Lt. Gen. Mohammed Al-Bassami said ahead of hajj that unpermitted pilgrims were “partners in this transgression” and repeated warnings that they would be arrested if they sought to participate in the rituals.

Unpermitted pilgrims could be said to bear responsibility for endangering their own lives, said Umer Karim , an expert on Saudi politics at the University of Birmingham in England. But, he said, “hajj authorities could have taken quick measures and that might have saved some lives.”

Among the dead were more than 680 Egyptians, officials from their government said, almost all of whom had participated without permits. An additional 700 Egyptians are still missing.

At least 212 Indonesians also died, according to the country’s Ministry of Religious Affairs, which identified widespread heat stroke and pneumonia as the most common causes. Ninety-eight Indian nationals died from causes including illness and injuries as well as extreme heat on the day when pilgrims visited Arafat, Indian foreign ministry spokesman Randhir Jaiswal said Friday. Both countries have suffered higher tolls in previous years.

Dozens of other pilgrims have also died, including from Jordan, Pakistan, Tunisia, Turkey and Iran.

It wasn’t clear how many Americans had died. “The situation is dynamic, so we do not have a precise number for you at this time,” the State Department spokesperson said late Thursday.

Many of those who died were sick or elderly, making them more vulnerable to heavy exertion in the heat. Recent studies have found that consistently rising temperatures in Mecca could jeopardize the running of hajj during summer months as soon as the 2040s.

People watch as Muslim pilgrims circle the Kaaba as they perform Tawaf at the Grand Mosque, during the annual haj pilgrimage, in Mecca, Saudi Arabia, June 18, 2024. REUTERS/Mohammed Torokman

Write to Stephen Kalin at stephen.kalin@wsj.com