Yelling “Death to America,” hundreds of protesters stormed the heavily guarded US embassy compound in Baghdad on Tuesday — only to be pulled up short by Marines with weapons ready.

The Iraqis were protesting US airstrikes that killed two dozen members of an Iranian-backed militia on Sunday — a slapdown that was long overdue, and which should serve as an inspiration for Iraq’s own government.

All 2019 long, Iran behaved abominably — from hijacking oil tankers in the Strait of Hormuz to shooting down US military drones to sponsoring (via its various “militia” pawns) strikes on two Saudi oil facilities and on an Iraqi Security Forces base in Kirkuk.

That last attack, on the Friday after Christmas, killed an American contractor and wounded several Iraqi troops and was the immediate cause of those US airstrikes on five Kataib Hezbollah targets — three in Iraq and two in Syria — over the weekend.

The locations included storage facilities and command-and-control centers that the Iran-backed Hezbollah uses to carry out such attacks.

“What we did is take a decisive response that makes clear what President Trump has said for months and months and months,” Secretary of State Mike Pompeo said Sunday, “which is that we will not stand for the Islamic Republic of Iran to take actions that put American men and women in jeopardy.”

Iraqi leaders on Monday accused the US of violating their nation’s sovereignty and called the airstrikes a “threat to the security of Iraq and the region.”

But it’s Iran’s armed pawns that pose the real threat to Iraq’s sovereignty — giving Tehran a near-veto on the formation of any Iraqi government. That influence promoted the corruption and religious divisions that paved the way for ISIS to seize control of much of the country, and could easily do the same again.

If Baghdad can’t find a way to suppress these militias, it’s at best set to become another Lebanon: a nominally independent country at the mercy of Iranian-allied terrorists who routinely put the nation at risk simply to serve Tehran’s interests.

Washington can’t save Iraq, as recent history shows all too well — but it can still help Iraqis save themselves.