At least 1,301 people died during Hajj, Saudi Arabia says, mostly unauthorised pilgrims who walked long distances in intense heat, according to BBC.

This year’s pilgrimage took place during a heatwave, with temperatures at times exceeding 50C (122F).

More than three-quarters of those who died did not have official permits to be there and walked under direct sunlight without adequate shelter, the official Saudi news agency SPA said.

Some of those who died were elderly or chronically ill, the agency added.

Health Minister Fahd Al-Jalajel said efforts had been made to raise awareness about the dangers of heat stress and how pilgrims could mitigate this.

Health facilities treated nearly half a million pilgrims, including more than 140,000 who did not have a permit, he said, and some were still in hospital for heat exhaustion.

“May Allah forgive and have mercy on the deceased. Our heartfelt condolences go to their families,” he said.

Saudi Arabia has been criticised for not doing more to make the Hajj safer, especially for unregistered pilgrims who have no access to facilities such as air conditioned tents and official Hajj transport.

Temperatures in Mecca climbed as high as 51.8C, according to Saudi Arabia’s national meteorological centre.

Countries across the world have been giving updates on the number of their citizens who died, but Saudi Arabia had not commented publicly on the deaths or provided an official toll until Sunday.

AFP news agency quoted an Arab diplomat as saying 658 Egyptians had died. Indonesia said more than 200 of its nationals lost their lives, while India gave a death toll of 98 people.

Pakistan, Malaysia, Jordan, Iran, Senegal, Sudan and Iraq’s autonomous Kurdistan region have also confirmed deaths.

Hajj is the annual pilgrimage made by Muslims to the holy city of Mecca. All Muslims who are financially and physically able must complete the pilgrimage at least once in their lifetime.

About 1.8 million people took part this year, Saudi Arabia said.

The fallout from the number of deaths, particularly involving unauthorised pilgrims, has been growing.

On Saturday, Egyptian Prime Minister Mostafa Madbouly stripped 16 tourism companies of their licences and referred their managers to prosecutors for enabling illegal pilgrimages to Mecca.

On Friday Jordan said it had detained several travel agents who facilitated the unofficial travel of Muslim pilgrims to Mecca. Meanwhile Tunisian President Kais Saied fired the minister of religious affairs.

Hajj permits are allocated to countries on a quota system and distributed to individuals by lottery.

However the costs involved prompt many to try to take part without a permit, although they risk arrest and deportation if caught.

Before the Hajj, Saudi authorities said they had removed hundreds of thousands of unauthorised pilgrims from Mecca.