Iranian Supreme Leader Ayatollah Ali Khamenei (L), accompanied by Ebrahim Raisi, Chief Justice of Iran, in front of the coffin of slain Iranian military commander Qasem Soleimani

America's military strategy in Iraq was thrown into confusion Monday as the Pentagon admitted a letter from a general informing the Iraqi government of an imminent US troop pullout was sent by "mistake."

The latest developments came as a sea of black-clad mourners in Tehran paid homage to Qasem Soleimani, the head of the Iranian Revolutionary Guards' Quds Force who was killed in a US strike in Iraq on Friday.

US Brigadier General William Seely informed his Iraqi counterparts in a letter dated Sunday that American troops were preparing to leave Iraq.

"We respect your sovereign decision to order our departure," said the letter, whose authenticity was confirmed to AFP by both Iraqi and US defence officials.

Seely said the US-led coalition would "be repositioning forces."

"In order to conduct this task, Coalition Forces are required to take certain measures to ensure that the movement out of Iraq is conducted in a safe and efficient manner," said the letter.

It said helicopters would be travelling in and around Baghdad's Green Zone where the US embassy is located as part of the preparations.

AFP could hear helicopters flying low over Baghdad throughout the night on Monday.

But Pentagon Joint Chiefs Chairman Mark Milley said on Monday the letter was a mere "draft" and "should not have been sent."

"It was a mistake, an honest mistake, a draft unsigned letter, because we are moving forces around," Milley told reporters in Washington.

US Defence Secretary Mark Esper said the letter was "inconsistent" with Washington's position and denied there had been a decision to leave Iraq.

The US drone strike that killed Soleimani, as well as Iraqi military commanders, has sparked fury in both Iran and Iraq, with Tehran vowing revenge.

Iraqi lawmakers on Sunday urged the government to oust all foreign troops from Iraqi soil.

- Trump threatens 'retaliation' -

Some 5,200 US soldiers are stationed across Iraqi bases to support local troops preventing a resurgence of the Islamic State group.

They make up the bulk of a broader coalition, invited by the Iraqi government in 2014 to help combat the jihadists.

On Monday, Iran's supreme leader Ayatollah Ali Khamenei fought back tears as mourners flooded the streets around Tehran University to honour Soleimani.

The targeted killing of the 62-year-old Soleimani saw Iran step back even further from the already tattered 2015 nuclear accord with world powers.

In an escalating war of words that has heightened international concern and rattled financial markets, Trump threatened yet more "major retaliation" if Tehran hits back, including strikes on Iranian cultural sites.

Writing in all-caps on Monday, Trump tweeted: "IRAN WILL NEVER HAVE A NUCLEAR WEAPON!"

- 'Path of sobriety' -

Iraq requested in a letter to the UN -- seen by AFP -- that the Security Council condemn the US drone strike, so that "the law of the jungle" was not allowed to prevail.

The operation represented "a dangerous escalation that could lead to a devastating war in Iraq, the region and the world," wrote the Iraqi ambassador to the UN, Mohammed Hussein Bahr-Aluloom.

NATO chief Jens Stoltenberg warned Iran must avoid "further violence and provocations" after the alliance held emergency talks in Brussels.

"At our meeting today, allies called for restraint and de-escalation. A new conflict would be in no-one's interest," he said.

Saudi Arabia -- an oil-rich US ally seen as vulnerable to Iranian counter strikes -- also appealed for calm.

The European Union, whose foreign ministers will hold emergency talks Friday, said it was in Iran and Iraq's interest to "take the path of sobriety and not the path of escalation."

EU diplomatic chief Josep Borrell said he "deeply regrets" Iran's latest step back from the nuclear deal.

The agreement had offered Tehran sanctions relief in return for curbs to prevent it acquiring nuclear weapons -- but Trump's withdrawal in 2018 dramatically weakened the deal.

Despite its latest step, Iran insisted it would continue to cooperate with the UN agency overseeing its atomic programme.

- Throngs of mourners -

The raw emotions sparked by the killing of Soleimani were on full display in Tehran, where state television said "several million" black-clad mourners filled the streets.

"The last time I remember such a crowd was at Ayatollah Khomeini's funeral 30 years ago," said Iranian journalist Maziar Khosravi.

Story continues