Iraq's Prime Minister Mustafa al-Kadhimi has survived an assassination attempt with armed drones that targeted his residence and officials says he was unharmed.
The attack early on Sunday was a major escalation amid tensions sparked by the refusal of Iran-backed militias to accept last month's parliamentary election results.
Two Iraqi officials told the Associated Press that seven of al-Kadhimi's security guards were injured in the attack with two armed drones which occurred in Baghdad's heavily fortified Green Zone area.
They spoke on condition of anonymity because they were not authorised to give official statements.
"I am fine and among my people. Thank God," the prime minister tweeted shortly after the attack. He called for calm and restraint, "for the sake of Iraq".
He later appeared on Iraqi television, seated behind a desk in a white shirt, looking calm and composed. "Cowardly rocket and drone attacks don't build homelands and don't build a future," he said.
In a statement, the government said an explosives-laden drone tried to hit al-Kadhimi's home. Residents of Baghdad heard the sound of an explosion followed by heavy gunfire from the direction of the Green Zone, which houses foreign embassies and government offices.
The statement released by state-run media said security forces were "taking the necessary measures in connection with this failed attempt".
There was no immediate claim for the attack. It comes amid a stand-off between security forces and pro-Iran Shi'ite militias whose supporters have been camped outside the Green Zone for nearly a month after they rejected the results of Iraq's parliamentary elections in which they lost around two-thirds of their seats.
Protests turned deadly on Friday when the demonstrators tried to enter the Green Zone. Security forces used tear gas and live ammunition. There was an exchange of fire in which one protester affiliated with the militias was killed. Dozens of security forces were injured.
Some of the leaders of the most powerful militia factions loyal to Iran openly blamed al-Kadhimi for Friday's clashes and the protester's death.
The funeral was attended by leaders of the mostly Shi'ite Iran-backed factions who together are known as the Popular Mobilisation Forces, or Hashd al-Shaabi in Arabic.
Abu Alaa al-Walae, commander of Kataib Sayyid al-Shuhada, in a tweet apparently addressed to al-Kadhimi that did not name him told him to forget about another term.
Al-Kadhimi, 54, was Iraq's former intelligence chief before becoming prime minister in May last year. He is considered by the militias to be close to the US, and has tried to balance between Iraq's alliances with both the US and Iran.
Ali Shamkhani, secretary of Iran's national security council, said indirectly in a tweet Sunday that the US was behind the attack.
The assault on al-Kadhimi "is a new sedition that must be traced back to foreign think tanks, which have brought nothing but insecurity, discord & instability to oppressed Iraqi people through creation & support of terrorist groups & occupation of this country for years", he said.
The US strongly denounced "this apparent act of terrorism". State Department spokesman Ned Price said the US was in close contact with Iraqi security forces and had offered to help with the investigation into the attack.
Egyptian President Abdel Fattah el-Sissi also condemned the assassination attempt, as did Saudi Arabia, which issued a statement of support for stability in Iraq.
The US, the UN Security Council and others have praised the October 10 election, which was mostly violence-free and without major technical glitches.