BAGHDAD — Radical Sunni militants aligned with Al Qaeda threatened Thursday to seize control of Falluja and Ramadi, two of the most important cities in Iraq, setting fire to police stations, freeing prisoners from jail and occupying mosques, as the government rushed troop reinforcements to the areas.

Dressed in black and waving the flag of Al Qaeda, the militants commandeered mosque loudspeakers to call for supporters to join their struggle in both cities in the western province of Anbar, which have increasingly become centers of Sunni extremism since American forces withdrew from the country at the end of 2011.

For the United States, which asserted at the time that Iraq was on track to become a stable democracy, Anbar holds grave historical significance — as a place for America’s greatest losses, and perhaps its most significant success, of the eight-year war.

Nearly one-third of the American soldiers killed in the war died trying to pacify Anbar, and Americans fought two battles for control of Falluja, in some of the bloodiest combat that American troops had faced since Vietnam.

The violence in Ramadi and Falluja had implications beyond Anbar’s borders, as the Sunni militants fought beneath the same banner as the most hard-line jihadists they have inspired in Syria — the Islamic State of Iraq and Syria, or ISIS.

That fighting, and a deadly bombing in the Beirut area on Thursday, provided the latest evidence that the Syrian civil war was helping breed bloodshed and sectarian violence around the region, further destabilizing Lebanon and Iraq while fueling a resurgence of radical Islamist fighters.

It was not possible, amid the unfolding chaos, to determine a precise number of casualties, but officials in hospitals in Anbar reported at least 35 people were killed Thursday and more than 70 were wounded. Security officials in Anbar said the total killed over several days of fighting was 108, including 31 civilians and 35 militants. The rest of the dead were Iraqi security force members.

The fighting began after Prime Minister Nuri Kamal al-Maliki, a Shiite, ordered security forces to dismantle protest encampments in Falluja and Ramadi.

The order came after fighting erupted following the government’s arrest of a prominent Sunni lawmaker who had been a supporter of the protests, which had been going on for more than a year and had become an outlet for disenchanted Sunnis angered over their treatment by Mr. Maliki’s Shiite-dominated government. The arrest attempt set off a firefight that left several bodyguards and the brother of the lawmaker dead, and led to clashes between the government and armed tribesmen.

Officials later seemed to have calmed the situation, and in a deal between local tribal leaders and the central government, Mr. Maliki agreed to withdraw army troops from Anbar on Tuesday.

Image

Qaeda militants took over a police truck in Falluja.CreditAssociated Press

But as soon as any trace of government authority vanished, large numbers of Qaeda-aligned fighters attacked the cities, and by Wednesday the prime minister reversed his decision. He sent troops to try to secure the support of local tribal leaders, offering them guns and money to join forces with the regular army.

In a telephone interview on Thursday, one tribal fighter loyal to the government, Abu Omar, described heavy clashes across Falluja, and said the government had started shelling militant hide-outs.

“We told all the families to leave their houses,” he said over the phone, with the sound of gunfire in the background. “Many of the families fled from the city, and others are still unable to because of the heavy clashes. We have reports that the hospital in Falluja is full of dead and wounded people.”

Many of the tribesmen fighting alongside government security forces have been doing so reluctantly, making the calculation that, in this case, the government is the lesser evil than Al Qaeda.

Sheikh Hamed Rasheed Muhana echoed what many Sunnis in Iraq feel when he complained that the government had alienated Sunnis with harsh security crackdowns and mass arrests of Sunni men, militants and ordinary civilians alike. He said the government had worsened matters by “creating more depressed people willing to join Al Qaeda because of the sectarian behavior and ongoing arrests.”

Also on Thursday, in a move that seemed calculated to appease Sunni resentment, the government arrested a Shiite militia leader in Baghdad who is believed to be the leader of the Iraqi affiliate of Hezbollah, the Lebanese militant group.

Thursday was the fourth consecutive day of battles in Anbar. Late in the afternoon, security officials said the government had regained some territory in Ramadi but that fighting was still fierce in Falluja, where militants controlled a much larger portion of the city than they did in Ramadi.

American officials have been in touch with the Maliki government and its Sunni critics, trying to encourage them to join forces against Al Qaeda.

“We’ve encouraged the government to work with the population to fight these terrorists,” said Marie Harf, a State Department spokeswoman.

The chaos in Anbar has underscored the steady deterioration of Iraq’s security since the withdrawal of American forces. The battles have heightened fears that Iraq is descending into the type of sectarian civil war that it once faced during the American-led occupation.

The center of that unrest was in the desert region of Anbar, a cradle of Sunni discontent where swaggering tribesmen defied authority even under Saddam Hussein. An American pact with those Anbar tribesmen in 2007 — to pay them to switch sides and fight alongside the United States against Al Qaeda — became known as the Awakening and is considered partly responsible for turning the tide of the war.

Abu Risha, a leading tribal sheikh in Ramadi, was perhaps the Americans’ most stalwart partner, and even today he is likely to show visitors the plaques he received from American officers, and old pictures of him with American soldiers, even as he speaks of what he calls betrayal by the United States for leaving without finishing the job.

In a statement released this week, he exhorted his men to again fight Al Qaeda, and hinted at business left unfinished by the Americans.

“We were all surprised that the terrorists left the desert and entered your cities to return a second time, to commit their crimes, to cut off the heads, blow up houses, kill scholars and disrupt life,” he said. “They came back, and I am delighted for their public appearance after the security forces failed to find them. Let this time be the decisive confrontation with Al Qaeda.”

Violence continued elsewhere in the country on Thursday, with a suicide attack in a market in Diyala Province killing at least 17 people, and two explosions around Baghdad that killed eight.

In another indication that the war in Syria is reverberating back here, Iraqis who fled the country by the thousands after the American invasion and then began to return as the fighting eased are becoming refugees again.

On Thursday, Andrew Harper, an official with the United Nations refugee agency in Jordan, posted a message on Twitter saying that over the past three weeks the number of Iraqi refugees entering Jordan, which borders Anbar Province, had increased fivefold, with an average of 415 Iraqis leaving their country each week.

Analysts have long worried that the war in Syria would engulf Iraq, as hard-line Sunni rebels in Syria have said they see the two countries as one battlefield in the fight for Sunni dominance. For some time, the Syrian war has dragged in Iraqis along sectarian lines, with Iraqi Shiites rushing to Syria to support the government of President Bashar al-Assad, and Iraq’s Qaeda affiliate fostering the most extremist Sunni fighting units across the border.

These fears of spillover have been most acute in Anbar’s ungovernable desert, which borders Syria and where tribal loyalties cut across national boundaries, making it fertile territory for Al Qaeda’s resurgence.

Earlier in the week many tribesmen fought against the government, following the arrest of the Sunni lawmaker and the dismantling of the protest tents, but when Al Qaeda returned many quickly switched sides.

“We don’t want to be like Syria,” said Sheikh Omar al-Asabi, who led a group of fighting men in an area east of Falluja.

For many men of Anbar over the last several years, fighting has been a constant, even as the enemy has shifted. “We fought the Americans, and we fought the Maliki army, and now we are fighting Qaeda,” said Firas Mohammed, 28, who is an engineer when he is not at war. “We will not allow any outsider to come here and impose his will on us.”

Correction:

A picture, which appeared on this article earlier, contained incorrect caption information. Using information from Agence France Presse, the caption misidentified the city in which the photograph was taken and the date it was taken. The photograph, of a burning police vehicle, was taken in Falluja on Wednesday, not Ramadi on Thursday.

Yasir Ghazi reported from Baghdad, and Tim Arango from Istanbul. An employee of The New York Times contributed reporting from Falluja, Iraq, and Michael R. Gordon from Jerusalem.

A version of this article appears in print on , on Page A1 of the New York edition with the headline: Qaeda-Aligned Militants Threaten Key Iraqi Cities. Order Reprints | Today’s Paper | Subscribe