Tensions between the United States and Iran have been escalating throughout 2019 but these two foes waited until the last day of the year to take their relationship on a dangerous turn.

In what perhaps will become an indication of where this year is headed, the US embassy in Baghdad was lit on fire and came under siege last night.

The fact that the embassy in the Iraqi capital was attacked is not a surprise.

The country has become a flashpoint for tensions with the Iranian regime and the Iraqi militias that align with it.

But there is no doubt that this represents a rapid upsurge in tensions that have been bubbling for months as the US and Iran continue to battle for influence in Iraq.

It started with an airstrike

In recent months, the Iranian-back militia group Kataib Hezbollah has been firing rockets at Iraqi bases that house US troops.

There have been casualties, but it wasn't until an American civil contractor was killed last week that the US decided to retaliate.

America blamed the Iran-backed group and on Sunday launched five air strikes on ammunition facilities and command posts controlled by the militia group in Syria and Iraq, as the US attempted to show its enemies it wouldn't put up with the behaviour anymore.

Twenty-five people died and many more were injured.

It infuriated the militias and drew widespread condemnation from across the region.

Even Baghdad was angry, labelling the strikes a violation of Iraqi sovereignty and warning it could destabilise the entire region.

It didn't take long for the group to rally its troops and take to the streets.

Protesters and militia fighters gather outside the main gate of the US embassy. ( Reuters: Thaier al-Sudani )

They managed to breach Baghdad's so-called "green zone", a heavily fortified part of the city housing international embassies, which suggests Iraqi security forces didn't try to stop them.

They hurled projectiles at embassy security, lit fires and destroyed command posts, all the while chanting "death to America".

It sent a clear message to the White House — that Iranian-back militias in Iraq have the power to intimidate America, even on foreign soil.

It highlights the fact that the US has very few political allies left in Iraq and indicates the embassy and other US facilities have and will continue to become the epicentre of a proxy struggle between Washington and Tehran.

Understandably, US President Donald Trump wasn't pleased

Loading

Loading

He tweeted several times, accusing Iran of orchestrating the attack and saying he expects "Iraq to use its forces to protect the embassy, and so [are] notified!".

And despite an assurance from the Iraqi Government of protection of Americans on the ground, the Pentagon has decided to send in more troops and two apache helicopters as air support.

So, hang on, how did we get here?

Well, the relationship between Tehran and Washington has been deteriorating since Mr Trump pulled out of the 2015 nuclear deal and reimposed economic sanctions on the country.

The President has always made it clear he viewed Iran with suspicion, and he didn't think the Obama administration had done enough to curtail Iranian influence across the region.

But despite the economic and political pressure on Iran, there is no indication that the country has curtailed its support for foreign militias.

In other words, Mr Trump is losing ground on countering Iran's growing influence.

Aside from the rocket launches in Iraq, Iran has been linked to an attack on a Saudi oil facility, as well as others on foreign tankers in the Persian Gulf.

But these sour grapes date back further.

Iran was a close ally of the US during most of the reign of Shah Mohammad Reza Pahlavi.

But when Pahlavi was overthrown by the 1979 Iranian revolution, Iranian militants took 70 Americans hostage and held them for 444 days.

That was the beginning of a rapidly deteriorating relationship.

Washington and its allies in the region also suspect Iran is developing a nuclear weapons program, hence Mr Trump's maximum pressure campaign.

So why are both interested in Iraq?

Loading

The power struggle for influence in Iraq dates back to the US-led invasion in 2003, which toppled Saddam Hussein's bloody rule.

Iraq become dominated by Shiite political groups, some of whom were allied with Iran.

Troops remained in the country to combat a violent insurgency and despite withdrawing in 2011 they redeployed in 2014 to combat the rise of the Islamic State group (IS), which was born from Syria's civil war.

Iran has long been accused of running a network of proxies across the Middle East, using militia groups and political parties to undermine rival governments.

In Iraq, there are a number of Shiite militias. They have been increasing political clout since the battle against IS, gaining almost a third of the seats of Iraq's Parliament in 2018 elections.

Loading

As we mentioned before, the frequent rocket attacks in recent months on Iraqi bases have sent the relations on a downward spiral and underlined fears a proxy war between the two countries is being played out on Iraqi soil.

Following the strikes on Sunday, US State Department officials laid blame not only on Iran but also Iraq, saying Baghdad had failed to protect America.

Expect more turmoil in 2020

The ease with which militia forces managed to breach the embassy surprised many and raises questions about how much backing America still has from Iraq's fractured Parliament.

The beginnings of a proxy war come at a terrible time for Baghdad, which has been crippled by political paralysis and embroiled in deadly domestic protests, all of which have left the economy in the doldrums.

Iran has invested heavily in deepening its influence in an arc from Iraq through Syria to Lebanon and will not give up its strategic gains without a fight, even as US sanctions make its expansionism more difficult.

What is clear: The airstrikes will further embolden pro-Iranian blocs of Iraq's Parliament to push harder for the expulsion of US forces from the country.

The militias are rallying their troops to launch more attacks, while the Pentagon is upping its ground and air support, all laying the groundwork for a broader destabilisation of the region.