The pilgrimage now seems to be acting as an icebreaker between the two powers. (File Photo)

Tehran: In a diplomatic icebreaker between political foes, tens of thousands of Muslim faithful from Iran have flocked to Saudi Arabia for the annual hajj pilgrimage to Islam's holiest sites.

This week's hajj marks Iran's return after their absence last year following a massive stampede in 2015 that killed around 2,300 people, including 464 Iranians.

The tragedy sparked bitter recrimination from Tehran over the kingdom's custodianship of the sites in Mecca and Medina, western Saudi Arabia.

For the first time in nearly three decades, Iranian pilgrims were barred from the hajj last year, after several rounds of negotiations between the two Gulf heavyweights failed to overcome political and procedural differences.

Adding a further obstacle, the Sunni kingdom cut all ties with Shiite Iran in January 2016 after its diplomatic missions in Tehran and Mashhad were torched by protesters angered by Saudi Arabia's execution of a prominent Shiite figure.

But under a deal struck in March, about 86,000 Iranians have now arrived in Saudi Arabia for the hajj, joining two million Muslims from across the globe in converging on Mecca.

"I'm happy to see so many Iranians here... Political issues shouldn't interfere in a religious duty, especially the hajj," Abbas Ali, a 54-year-old Iranian, said Monday at Jeddah airport that is the main entry point for pilgrims.

"It's very difficult to describe my feelings. We shouldn't stop coming here because all of us are Muslims," the newly-arrived "haji" from Zahedan in eastern Iran said.

The breakthrough came after several months of negotiations during which the two countries traded accusations of obstructing an agreement.

- Diplomats to inspect empty embassies -

Tehran and Riyadh stand on opposing sides in several regional disputes, including the conflicts in Syria, Yemen and Bahrain, as well as this year's Gulf diplomatic crisis between Qatar and a Saudi-led Arab bloc.

The pilgrimage now seems to be acting as an icebreaker between the two powers.

In the absence of diplomatic relations and with its missions in Iran closed, Saudi Arabia agreed to issue electronic visas for Iranian pilgrims.

Saudi Arabia has also allowed Iran's national carrier Iran Air to fly in most of the Islamic republic's pilgrims, while some were transported by the kingdom's carrier.

Iranian Foreign Minister Mohammad Javad Zarif said last week that visas have been issued for diplomats from the two countries to visit and inspect each other's empty embassies and consulates.

"We are waiting for final measures to be taken so diplomats from both countries can visit," he said. "This will probably happen after the hajj."

Iran has set up temporary consulates in the kingdom to assist its pilgrims, and it has instructed them to avoid "arguments" with Saudi staff at airports and pilgrimage sites.

"We have tried to separate the bilateral relations between the two countries from the pilgrimage," a former Iranian culture minister, Seyed-Reza Salehi Amiri, said last month.

In another key gesture, Tehran is to hold Shiite prayers, normally accompanied by chants of "Death to America" and "Death to Israel", inside hotels rather than outdoors, to avoid "security problems", according to Ali Ghazi Askar, an aide to Iran's supreme leader Ali Khamenei.

In 1987, more than 400 people, most of them Iranian pilgrims, were killed in clashes with Saudi security forces at an anti-Western rally in Mecca.

The hajj, which starts this year on Wednesday, is one of the five pillars of the Islamic faith, which every Muslim is required to complete at least once in a lifetime if he or she has the means to do so.