A picture taken on April 17, 2017 shows flames rising at the West Qurna-2 oilfield, west of Basra in southern Iraq

Baghdad (AFP) - Iraq has won an exemption allowing it to buy Iranian electricity despite US sanctions, as the country plagued by chronic power shortages walks a tightrope between rivals Washington and Tehran.

With US measures imposed Monday taking aim at Iran’s banking and energy industries, there were concerns Iraq – which heavily relies on its eastern neighbour for electricity and consumer goods – would be caught in the crossfire.

But Baghdad has managed to secure an exception.

“We granted Iraq a waiver to allow it to continue to pay for its electricity imports from Iran,” Brian Hook, the State Department’s representative on Iran, announced Wednesday.

Iraq would be expected to show the US how it would wean itself off Iranian gas, a well-informed source told AFP.

“The US gave us 45 days to give them a plan on how we will gradually stop using Iranian gas and oil,” the source said.

“We told them it may take us up to four years to either become self-sufficient or find another alternative.”

The exemption came after talks between Iraqi and US officials, including from the White House and Treasury, the source said.

Iraqi government representatives have shuffled between American and Iranian officials for months in a bid to insulate their fragile economy from escalating tensions.

An Iraqi man changes US dollars for Iranian rials in Basra on November 6, 2018

This week, Prime Minister Adel Abdel-Mahdi said Baghdad was in talks with both sides to protect its interests.

“Iraq is not a part of the sanctions regime. It talks to everyone, and does not want to get involved in a conflict that it’s not a part of,” he told reporters Tuesday.

Baghdad has a strong relationship with the United States, coordinating on security, politics, and governance.

But its economy is profoundly intertwined with that of Iran.

- Keeping the lights on -

Gutted by the international embargo of the 1990s and the US-led invasion of 2003, Iraq’s industries produce little.

Instead, its markets are flooded with Iranian goods – from canned food and yoghurt to carpets and cars.

Iraq's economy is profoundly intertwined with that of Iran, and its markets are flooded with Iranian goods like these washing machines seen at a Baghdad store on August 6, 2018

These non-hydrocarbon imports amounted to some $6 billion (five billion euros) in 2017, making Iran the second-largest source of imported goods in Iraq.

Perhaps most consequential for Iraq’s 39 million people is their dependency on Iran for electricity.

Chronic cuts, which often leave homes powerless for up to 20 hours a day, were a key driving factor behind weeks of massive protests in Iraq this summer.

To cope with shortages, Baghdad pipes in natural gas from Tehran for its plants and also directly buys 1,300 MW of Iranian-generated electricity.

That reliance is uncomfortable for the US, whose quest to diminish Tehran’s influence prompted it to reimpose sanctions on Iranian financial institutions, shipping lines, energy, and petroleum products on Monday.

Eight countries would be temporarily allowed to import Iranian crude oil.

Iraq’s special exemption appears to have come with a condition that it lay out how it would stop using Iranian electricity, said Nussaibah Younes, a senior adviser for the European Institute of Peace.

“In order to get this exemption, the Iraqis had given some sort of roadmap idea,” Younes told AFP.

One way would be capturing the gas set alight when Iraq extracts oil, which according to the World Bank represents an annual loss of about $2.5 billion – enough to fill the gap in Iraq’s gas-based power generation.

- Appeasing Iran -

American firms may help fill the vacuum left by Iran.

In January, Iraq signed a memorandum of understanding with US energy company Orion on gas exploits at a southern oil field.

And in October, Iraq signed a memo with the US’s General Electric to revamp the electricity sector, after signing a similar agreement with Germany’s Siemens.

Labourers stack appliance boxes at a store in the Iraqi capital, Baghdad on August 8, 2018

The source told AFP that GE was among several US companies proposed to Baghdad during negotiations with the US.

But Iraq has had to simultaneously reassure Iran, in part by granting it an outlet to circumvent US sanctions.

“The focus for the Iranians is informal sanctions-busting activity in Iraq, including accessing hard currency through Iraqi exchanges and through smuggling operations,” said Younes.

Baghdad, she expected, would likely “turn a blind eye”.

Iraq has simultaneously been granting Iranian officials more time for face-to-face meetings, including its ambassador in Baghdad, Araj Masjadi.

He met with new Finance Minister Fuad Hussein and Electricity Minister Luay al-Khateeb on Wednesday, pledging close cooperation on the power sector in the future.

For Masjadi, the meetings appeared to be a reminder of Tehran’s entrenched role in Iraq.

“We need Iraq the way Iraq needs us,” said Masjadi.