BAGHDAD — It started quietly a month or so ago with scattered protests. Those steadily expanded until last week more than 200,000 Iraqis marched in Baghdad, raging against the Iraqi government and a foreign occupier — not the United States this time, but Iran.

While the current leaders of the Iraqi government cower inside the Green Zone, where officials running the American occupation once sheltered, the protesters outside direct their anger against the Islamic Republic of Iran, which they now see as having too much influence.

“Free, free Iraq,” they shout, “Iran get out, get out.”

On the streets and in the squares of Iraq’s capital, in the shrine city of Karbala — where protesters on Sunday threw gasoline bombs at the Iranian Consulate — in back alleys and university hallways, a struggle is taking place over who will shape the country’s future. Iraq, along with Lebanon, another heavily Shiite country that has been roiled by protests, is part of a developing revolt against efforts by Shiite-dominated Iran to project its power throughout the Middle East