The US last year shut its consulate in the protest-hit southern Iraqi city of Basra

The US State Department on Wednesday ordered all non-emergency staff to leave its embassy in Baghdad and consulate in Arbil, as tensions mount between the United States and Iraq's neighbor Iran.

Washington has ramped up pressure on Tehran in recent days, accusing Iran of planning "imminent" attacks in the region, and bolstering the American military presence in the Gulf.

"Numerous terrorist and insurgent groups are active in Iraq and regularly attack both Iraqi security forces and civilians," a travel advisory warned.

"Anti-US sectarian militias may also threaten US citizens and Western companies throughout Iraq."

The US last year shut its consulate in the protest-hit southern Iraqi city of Basra, blaming "indirect fire" by Iran-backed forces and warning its rival of retaliation for any damage.

US Secretary of State Mike Pompeo last week paid a surprise trip to Baghdad in a move to bolster ties with Iraq as it pushes ahead with its "maximum pressure" against Tehran -- a US arch-rival, but an ally of Iraq.

He told reporters he had made the trip because Iranian forces are "escalating their activity" and said the threat of attacks were "very specific."

Pompeo met with Iraq President Barham Saleh and Prime Minister Adel Abdel Mahdi, and spoke to them "about the importance of Iraq ensuring that it's able to adequately protect Americans in their country."

The Pentagon said it was sending several massive, nuclear-capable B-52s to the region in response to "recent and clear indications that Iranian and Iranian proxy forces were making preparations to possibly attack US forces."

Both Pompeo and Iran's supreme leader Ayatollah Ali Khamenei have this week played down fears that their countries were seeking conflict.

But National Security Advisor John Bolton warned Iran that Washington would respond with "unrelenting force" to any attack by Tehran, including by its regional allies.

Blasts involving improvised explosive devices (IEDs) occur in many areas of Iraq, including the capital Baghdad, the advisory added. Arbil is the Iraqi Kurdish regional capital, in northern Iraq.