BAGHDAD — The Trump administration’s decision to reimpose sanctions on Iran is rebounding on neighboring Iraq, hitting investors with dramatic losses at a time when the American ally is already facing unrest because of tough economic conditions.

As their country flirted with economic collapse in 2015 under the weight of an Islamic State onslaught, Iraqis poured millions of dollars into Iranian banks that were offering sky-high interest rates following Iran’s nuclear ­accord with the United States. Many Iraqis used mules to carry thousands of dollars into Iran to bypass laws regulating how much money could be taken out of the country.

Now, with the United States pulling out of the nuclear deal and renewing trade sanctions on Iran, the value of the Iranian rial has plummeted to historic lows, staggering investors.

The Iraqi financial distress is a stark example of how the rivalry between Tehran and Washington can destabilize Iraq, which is already confronting widespread discontent over economic uncertainty and anxiety over a halting political transition in which the United States and Iran have a significant stake.

The fallout from the sanctions also illustrates how the economic well-being of regular Iraqis is more closely linked with Iran’s market than with the United States, whose influence is rarely felt in day-to-day life.

The reimposition of trade sanctions on Iran last week has sparked a fierce public debate in both Baghdad and Tehran over Iraq’s obligation to abide by the sanctions. Iraq is a major trading partner for Iran — but the back-and-forth has largely revolved around Iraq’s political allegiances.

Iraqi Prime Minister Haider al-Abadi initially said last week that he opposes sanctions on principle but has little choice but to honor them. That provoked a vigorous backlash at home and in Iran, with Tehran’s allies in Iraq calling the decision to honor the sanctions a betrayal following Iran’s support for Iraq in its fight against the Islamic State.

On Monday, Abadi walked back his earlier commitment, saying Iraq would refrain only from conducting business with Iran in U.S. dollars. He said there was no decision yet on whether Iraq would suspend imports of major goods from Iran. In a concession to his powerful neighbor, Abadi said visa fees for Iranian pilgrims to Shiite holy sites in Iraq would be reduced to compensate for the weakened value of the Iranian rial.

But for many Iraqis, the crisis is less philosophical and far more tangible. Since President Trump announced his decision to remove the United States from the Iran nuclear deal, the Iranian rial has lost nearly 50 percent of its value against the dollar.

And there is little relief in sight. The rial is expected by analysts to continue to lose value into November, when a second round of American sanctions, on oil sales, will go into effect.

“The main attraction of investing in Iranian banks was the relatively stable foreign exchange rate, which has now collapsed,” said Bijan Khajehpour, an expert on Iran’s banking sector and the managing partner of Vienna-based Atieh International Consulting, a strategic consulting firm.

That leaves Iraqis such as Hussain al-Kaabi in the lurch. 

Kaabi, a 41-year-old real estate investor, said he deposited his life savings, about $150,000, into an Iranian bank offering 20 percent interest in 2015. At the time, Iraq’s real estate market was collapsing in the face of the Islamic State threat.

“People stopped buying houses because the future was unknown,” Kaabi recalled.

But next door, the future was looking significantly brighter. Iran had signed on to a nuclear agreement with the United States and European nations that promised to pull Iran’s economy out of isolation.

Now, the outlook for the two countries has been reversed, and Kaabi estimates that his losses on the deposit have set him back 10 years financially.

“The Americans have never done anything good in the Middle East,” he said. “Everything they do damages us, whether militarily, politically or financially.”

While Kaabi blames the Trump administration for his tribulation, others in his position are frustrated with the Iranian government for not reining in unrealistic promises of 20 to 25 percent returns.

Even without the exchange rate crisis, Iraqi investors could have suffered losses after gambling on shaky or dishonest banks — as have many Iranian investors. Iran’s economic crisis has magnified those losses.

“I blame the Iranian government because they played dirty game with us,” said Nadhim al-Khafaji, a 60-year-old hotel owner in the southern Shiite holy city of Najaf who has lost more than half of the $100,000 he deposited in an Iranian state bank in April 2015. “They seduced us with the huge bait of the 20 percent profit and used us to take our money.”

Some experts blame the Iraqi investors.

“The law can’t protect dupes,” said Bassem Jameel Antoine, an Iraqi economist. Antoine said it is impossible to know how many Iraqis put their money into Iranian banks because it was done mostly illegally with money smuggled across the border.

He said the Iranian banks did not specifically target Iraqis with advertising but instead relied on word of mouth in the large Shiite population centers such as Najaf, Basra and Karbala that host millions of Iranian religious pilgrims annually.

Antoine said he advised people against depositing money into the Iranian banks because of the volatility of currency trading and the promise of 20 percent returns, which should have been a red flag.

“I knew there was something suspicious because nowhere in the world does a bank give 20 percent,” he said. “Two, three or four percent is reasonable. But not 20.”

Abdulrahman Shanyor, a 48-year-old Iraqi importer, said the terms imposed by the Iranian banks should have given him pause, but the high interest rate was too tempting. He deposited $110,000 despite the bank stipulating that the sum would be converted from dollars to rials and that he could not withdraw any amount for a full year. And then, any withdrawal would have to be in rials — not the dollars originally deposited.

“I blame myself only,” he said. “In business sometimes you make money and sometimes you lose money, but we thought that the Iranian rial will be always stable.”

Shanyor said he has sold his car to make up for the losses and keep his business afloat.

Karim Sadjadpour, an Iran expert with the Carnegie Endowment for International Peace, said the astronomical interest rates offered by Iranian banks have long been a “mirage.”

“When you consider the country's susceptibility to high inflation or the devaluation of the Iranian currency, it’s always been a risky bet to put large sums of money in Iranian banks,” he said.

To make matters worse for the Iraqi investors looking to salvage what is left of their money, Iran’s banks have placed strict restrictions on withdrawals, limiting them to the equivalent of about $200 per day.