BAGHDAD (AP) -- The day after anti-government protests erupted in Iraq, Iranian Gen. Qassim Soleimani flew into Baghdad late at night and took a helicopter to the heavily fortified Green Zone, where he surprised a group of top security officials by chairing a meeting in place of the prime minister.
The arrival of Soleimani, the head of Iran's elite Quds Force and the architect of its regional security apparatus, signaled Tehran's concern over the protests, which had erupted across the capital and in Iraq's Shiite heartland, and included calls for Iran to stop meddling in the country.
The protests in Iraq and Lebanon are fueled by local grievances and mainly directed at political elites, but they also pose a challenge to Iran, which closely backs both governments as well as powerful armed groups in each country. An increasingly violent crackdown in Iraq and an attack by Hezbollah supporters on the main protest camp in Beirut have raised fears of a backlash by Iran and its allies.
"We in Iran know how to deal with protests," Soleimani told the Iraqi officials, according to two senior officials familiar with the meeting who spoke on condition of anonymity to discuss the secret gathering. "This happened in Iran and we got it under control."
But nearly a month later, the protests in Iraq have resumed and demonstrations continue in Lebanon, both directed at governments and factions allied with Tehran. The protests threaten Iran's regional influence at a time when it is struggling under crippling U.S. sanctions.
The day after Soleimani's visit, the clashes between the protesters and security forces in Iraq became far more violent, with the death toll soaring past 100 as unidentified snipers shot demonstrators in the head and chest. Nearly 150 protesters were killed in less than a week.
During renewed protests this week, men in black plainclothes and masks stood in front of Iraqi soldiers, facing off with protesters and firing tear gas. Residents said they did not know who they were, with some speculating they were Iranians.
"Iran is afraid of these demonstrations because it has made the most gains in the government and parliament through parties close to it" since the U.S.-led invasion of Iraq in 2003, said Hisham al-Hashimi, an Iraqi security analyst. "Iran does not want to lose these gains. So it has tried to work through its parties to contain the protests in a very Iranian way."
It hasn't worked.
The protests in Iraq resumed Friday after a brief hiatus, with protesters massing in Baghdad's Tahrir Square and clashing with security forces as they tried to breach barricades on a bridge leading to the Green Zone, the seat of the government and home to several embassies. In southern Iraq, protesters have attacked and torched the offices of political parties and government-backed militias allied with Iran.
In a country that is OPEC's second-largest oil producer, impoverished residents complain that powerful Shiite militias tied to Iran have built economic empires, taking control of state reconstruction projects and branching into illicit business activities.
"All the parties and factions are corrupt, and this is connected to Iran, because it's using them to try and export its system of clerical rule to Iraq," said Ali al-Araqi, a 35-year-old protester from the southern town of Nasiriyah, which has seen especially violent clashes between protesters and security forces.
"The people are against this, and that is why you are seeing an uprising against Iran," he said.
Overnight Tuesday, masked men who appeared to be linked to Iraq's security forces opened fire on protesters in Karbala, a holy city associated with the martyrdom of one of the most revered figures in Shiite Islam. At least 18 protesters were killed and hundreds were wounded in bloodshed that could mark an ominous turning point in the demonstrations. In Baghdad, protesters burned an Iranian flag. Days earlier, protesters had gathered outside the Iranian Consulate in Karbala, chanting "Iran, out, out!"
In Lebanon, hundreds of thousands of people have taken to the streets, demanding the resignation of a government dominated by pro-Iran factions. As in Iraq, the protests are focused on local grievances .
"The protests in both Iraq and Lebanon are primarily about local politics and a corrupt political class that has failed to deliver," said Ayham Kamel, the Middle East and North Africa practice head at Eurasia Group.
The protests "showcase the failure of the proxy model where Iran is able to expand influence but its allies are unable to effectively govern," Kamel said.
Lebanese protesters have only rarely called out Iran and its main local ally, the militant Hezbollah group, but they have focused much of their rage on Lebanon's president and foreign minister, who come from a Christian party closely allied with Hezbollah.
A common chant, "All means all," implies that none of Lebanon's factions, including Hezbollah and its allies, are beyond reproach.
Last week, fistfights broke out at a main rally when protesters chanted against Hezbollah leader Hassan Nasrallah, who announced at around the same time that he was withdrawing his supporters from the protests. He said unspecified foreign powers were exploiting the protests to undermine his group, warning that such actions could plunge the country back into civil war.
On Tuesday, Hezbollah supporters rampaged through the main protest camp in central Beirut. Shortly thereafter, Prime Minister Saad Hariri, a Western-backed leader who had reluctantly partnered with the pro-Iran factions in a national unity government, resigned. The protesters returned to the square by sundown, cheering their first victory since the demonstrations began Oct. 17.
Hezbollah is the most powerful armed force in Lebanon and was alone in refusing to disarm after the 1975-1990 civil war. It justifies its arsenal by saying it's needed to defend the country from Israel, which occupied southern Lebanon from 1982 to 2000.
Hezbollah sent thousands of fighters to neighboring Syria to help defeat the uprising against Syrian President Bashar Assad, another key Iranian ally. Iraq's powerful Iran-backed militias, initially mobilized to battle the Islamic State group, have also fought alongside Assad's troops. And Iran violently suppressed its own pro-democracy protests, known as the Green Movement, after the disputed 2009 presidential election.
Iran has been largely silent on the protests, while expressing support for both governments, as well as Hezbollah. Foreign Ministry spokesman Abbas Mousavi has offered Tehran's "deep regret" about the scores of protesters killed in Iraq.
"We are sure that the Iraqi government, nation and clerics can overcome these problems," he said.