The US embassy in Baghdad urged American citizens in Iraq on Friday to "depart immediately", for fear of fallout from a US strike that killed top Iranian and Iraqi commanders.
"US citizens should depart via airline while possible, and failing that, to other countries via land," the embassy said in a statement.
General Qasem Soleimani, the powerful commander of Iran's Revolutionary Guards, was killed in a precision US air strike in Iraq ordered by President Donald Trump, the Pentagon announced on Friday, dramatically escalating tensions in the strategic Gulf region.
Soleimani was killed following the airstrike at Baghdad's international airport. The strike also killed the deputy chief of Iraq's powerful Hashed al-Shaabi paramilitary force.
The strike comes days after Trump threatened Tehran after Iraqi supporters of pro-Iranian regime factions laid siege to the US embassy in Baghdad, following deadly American air strikes on a hardline Hashed faction.
Reacting to Soleimani's death, Iran said the country and the "free nations of the region" will take revenge on the United States.
"There is no doubt that the great nation of Iran and the other free nations of the region will take revenge for this gruesome crime from criminal America," President Hasan Rouhani said, referring to Iran's allies across the Middle East.
Soleimani's "martyrdom ... by the aggressor and criminal America has saddened the heart of the nation of Iran and all the nations of the region," he said in a statement posted on the Iranian government website.
(With inputs from AFP and PTI)