Iran's supreme leader wept in grief with hundreds of thousands of mourners thronging Tehran's streets on Monday for the funeral of military commander Qassem Soleimani, killed by a US drone on the orders of US President Donald Trump.
As the coffins of General Qassem Soleimani and Iraqi militia leader Abu Mahdi al-Muhandis, who also died in Friday's attack in Baghdad, were passed over the heads of mourners, Soleimani's successor vowed to expel US forces from the region in revenge.
The killing of Soleimani, the architect of Iran's drive to extend its influence across the Middle East, has stoked concern around the globe that a broader regional conflict could erupt.
Trump has listed 52 Iranian targets, including cultural sites, that could be hit if Iran retaliates with attacks on Americans or US assets.
General Esmail Ghaani, the new commander of the Quds Force, the elite unit of Iran's Revolutionary Guards charged with overseas operations, promised to "continue martyr Soleimani's cause as firmly as before with the help of God, and in return for his martyrdom we aim to rid the region of America".
"God the Almighty has promised to take martyr Soleimani's revenge," he told state television. "Certainly, actions will be taken."
Other political and military leaders have made similar, unspecific threats. Iran, which lies at the mouth of the key Gulf oil shipping route, has a range of proxy forces in the region through which it could act.
The crowd in Tehran, which state media said numbered in the millions, recalled the masses that gathered in 1989 for the funeral of the Islamic Republic's founder, Ayatollah Ruhollah Khomeini.
Soleimani was a national hero to many - even those who do not consider themselves supporters of Iran's clerical rulers.
Aerial footage showed people packing thoroughfares and side streets and chanting "Death to America!", a welcome show of national unity for Tehran after anti-government protests in November in which many were killed.
Iran's demand that US forces quit the region gained traction on Sunday when Iraq's parliament backed the prime minister's recommendation for foreign troops to be ordered out.
Iraq's rival Shi'ite leaders, including ones opposed to Iranian influence, have united since Friday's attack to call for the expulsion of US troops, who number about 5,000, most of them advisers.
Soleimani, widely seen as Iran's second most powerful figure behind Khamenei, built a network of proxy forces to create a crescent of influence stretching from Lebanon through Syria and Iraq to Iran. Allies also include Palestinian and Yemeni groups.
He notably mobilised Shi'ite Muslim militia forces in Iraq that helped to crush Islamic State, the Sunni militant group that had seized control of swathes of Syria and Iraq in 2013-14.
Washington, however, blames Soleimani for attacks on US forces and their allies.
Prayers at Soleimani's funeral in Tehran, which was later due to move to his southern home city of Kerman, were led by Khamenei, who wept as he spoke.
His daughter Zeinab Soleimani told mourners the United States would face a "dark day" for her father's death.
Ismail Haniyeh, leader of the Palestinian militant group Hamas, on his first trip to Iran since taking up his role in 2017, said "resistance against American dominance will not be broken".
Adding to tensions, Iran said it was taking another step back from commitments under a 2015 nuclear deal with six powers that Washington withdrew from in 2018.
Britain said Iran's move was "extremely concerning" and Germany said it would still work to save the pact.
Since quitting the deal, the United States has imposed new sanctions on Iran, saying it wanted to halt Iranian oil exports, the main source of government revenues. Iran's economy has been in freefall as the currency has plunged.
Trump stood by remarks that cultural sites were potential targets, despite criticism from US politicians that this amounted to a threat to commit war crimes.
"They're allowed to kill our people. They're allowed to torture and maim our people. They're allowed to use roadside bombs and blow up our people. And we're not allowed to touch their cultural sites? It doesn't work that way," Trump said.
Democratic critics of the Republican president have said Trump was reckless in authorising the strike. Republicans in the US Congress have generally backed his move.
Trump also threatened sanctions against Iraq and said Baghdad would have to pay Washington for an air base in Iraq if US troops were required to leave.
It was not clear if Washington had advised its allies of its plans before killing Soleimani. Britain, which also has troops in Iraq, said it understood why the United States had acted but called for a de-escalation to avoid war.
Saudi Arabia's foreign minister said the region faced a "very dangerous moment", while Turkey said it would work to stop Iraq becoming a "conflict zone for other, third-party countries".
Oil prices climbed above $70 a barrel on concerns about an escalation.