TEHRAN, Iran -- Iraq on Wednesday offered to mediate between Saudi Arabia and Iran after tensions soared following the kingdom's execution of a Shiite cleric and attacks on two Saudi diplomatic posts in the Islamic Republic.

The standoff has seen Saudi Arabia sever diplomatic ties with its longtime regional rival and could hinder efforts to resolve the conflicts in Syria and Yemen, where Riyadh and Tehran back opposite sides, as well as affect the implementation of the Iran nuclear deal.

Iraqi Foreign Minister Ibrahim al-Jaafari proposed mediation during a news conference in Tehran, but also referred to the execution of Sheikh Nimr al-Nimr as a "crime." Saudi Arabia and its allies say al-Nimr was found guilty of terrorism charges, and that condemnations of the execution amount to meddling in Riyadh's internal affairs.

Iraq has undertaken a delicate balancing act amid the latest regional turmoil. The Shiite-led government in Baghdad relies on Iranian help to battle the extremist Islamic State group, but is also trying to repair ties to oil-rich Saudi Arabia, which last week sent an ambassador to Baghdad for the first time in 25 years.

Speaking alongside Iranian Foreign Minister Mohammad Javad Zarif, al-Jaafari said Iraq's place in the heart of the Middle East allows it to play a role in trying to "alleviate tensions."

"This responsibility has been given to us and we have been active from the early moments to lessen tensions to prevent a disaster from happening that could affect the entire region," he said.

Back in Iraq, however, thousands of Iranian-backed Shiite militiamen marched in Baghdad and across the south to protest the execution of al-Nimr. Qais al-Khazali, the head of the powerful Asaib Ahl al-Haq militia, gave a speech in the southern city of Basra in which he called on Baghdad to cut diplomatic ties with Saudi Arabia, expel the newly arrived ambassador and boycott Saudi goods.

Russia also has offered itself as a potential mediator, though it's unclear whether Saudi or Iranian officials have responded to the proposal.

Zarif, meanwhile, blamed Saudi Arabia for exacerbating the situation.

"We have treated these actions with magnanimity and nobleness but unfortunately our neighbour, Saudi Arabia, did not respond to it properly," he said. "The process of provoking tension must be stopped."

Iran's President Hassan Rouhani accused the Saudi government of fanning strife between Shiite and Sunni Muslims and creating "an Islamaphobic atmosphere" in world opinion, according to a news release from Iran's U.N. Mission.

At a Cabinet meeting Wednesday, Rouhani also accused the Saudis of providing money and weapons to "terrorists," carrying out airstrikes in Yemen, and obstructing "the victory of Iraqi and Syrian governments," the release said.

The diplomatic standoff between Iran and Saudi Arabia began Saturday, when the kingdom executed al-Nimr and 46 others convicted of terror charges -- the largest mass execution it has carried out since 1980.

Iranian protesters responded by attacking the Saudi Arabia's embassy in Tehran and its consulate in Mashhad. Late Sunday, Saudi Arabia announced it was severing relations with Iran because of the assaults. On Wednesday, Iranian diplomats in Saudi Arabia returned to Tehran, according to state media.

Since Saudi Arabia severed ties to Iran, a host of its allies have cut or reduced their ties as well. Among those is Bahrain, which said Wednesday it had broken up a Shiite militant group backed by the Lebanese Hezbollah and the Iranian Revolutionary Guard.

Bahrain's Interior Ministry accused the suspects of receiving $20,000 from Hezbollah leader Hassan Nasrallah, and of having links to those behind a July 2015 bombing that killed two police officers

Bahrain, home to the U.S. Navy's 5th Fleet, has a Sunni-ruled monarchy but a Shiite majority. It has faced low-level turmoil since 2011 Arab Spring-inspired protests by Shiites seeking more political rights. It has long accused Iran of fueling the unrest and sponsoring attacks in the country, something the Islamic Republic has denied.

Also on Wednesday, Qatar recalled its ambassador from Iran to protest the attacks on the Saudi diplomatic missions, according to a brief report carried by the official Qatar News Agency.

Oman broke its silence on the Mideast turmoil and called the Saudi diplomatic post attacks "unacceptable," while leaving its ties to Iran untouched. The sultanate has been a long-time mediator between Iran and the rest of the world and helped jumpstart negotiations for the nuclear deal with global powers reached last year.

In eastern Saudi Arabia, where al-Nimr agitated for greater political rights for Shiites in the Sunni-ruled kingdom, three days of mourning over his death were to end Wednesday night. Mohammed al-Nimr, the sheikh's brother, said people planned to hold a funeral Thursday for the cleric, though Saudi authorities already buried his corpses in an undisclosed cemetery.

Sheikh Nimr al-Nimr was a staunch critic of the Saudi government but always denied advocating violence.

Asked about the diplomatic post attacks, Mohammed al-Nimr said it was "not acceptable."

"We still believe that violence is not the right approach," he said. "About my brother, we were hoping to end it in a political way rather than in blood."

------

Gambrell reported from Dubai, United Arab Emirates. Associated Press writers Reem Khalifa in Manama, Bahrain, Susannah George in Baghdad and Joseph Krauss in Cairo contributed to this report.