BAGHDAD — Sunni militants fighting under the banner of Al Qaeda appeared to make gains across Anbar Province on Saturday, using snipers and rocket-propelled grenades in heavy street fighting as they secured nearly full control of Falluja and captured the strategic town Karma. Government forces and the tribal militias fighting with them seemed unable to resist the militants’ advances.

One senior police official in Anbar said Saturday that “Falluja is completely under the control of Al Qaeda.” Other reports suggested that some areas on the city’s outskirts were still being contested, while government forces positioned themselves outside Falluja. They shelled the city throughout Friday night and into Saturday morning, killing at least 19 civilians and wounding dozens more, according to a hospital official in Falluja. Civilians, terrified and running low on food, were fleeing the major cities to desert villages and, in some cases, to the homes of relatives in Baghdad.

The fighting that has been going on for days has proved to be a crucial test for Prime Minister Nuri Kamal al-Maliki’s Shiite-led government, which is facing an escalating Sunni-led insurgency that threatens to tear the country apart. The unrest and the seeming inability of the Iraqi government forces, who were trained and equipped by the United States at a cost of billions of dollars, to quell it underscores the steady deterioration of Iraq’s security since the last American troops left two years ago.

Over that time, Iraq’s Sunnis have become increasingly disenchanted with the policies of Mr. Maliki’s government, which has alienated Sunni leaders and carried out mass arrests of Sunni citizens in an effort to find insurgents. Such actions have made it harder for the government to halt the resurgence of Al Qaeda here.