TRIPOLI, Libya — The military swept into the country’s capital Monday with dozens of pickup trucks mounted with antiaircraft guns to drive out militiamen in a raid hailed by Libyans frustrated with the numerous armed groups.
Libya is experiencing its strongest public uproar yet against militias, which have fueled lawlessness nationwide since the 2011 fall of longtime leader Moammar Khadhafy. The heavily armed groups, some led by Islamic extremist commanders, have defied control by the weak central government, carving out fiefdoms, acting as a law unto themselves, and imposing their control.
But the move to rein in militias risks detonating an explosive backlash leading to outright battles among rival militias.
Because many of the militias are rooted in specific cities and act as arms of political groups, any violence could pit city against city in this already fragmented nation. Monday’s sweep was the most assertive yet by the military, but the government’s armed forces and police remain weak and rely on allied militias for firepower.
Drivers honked their horns and flashed V-for-victory signs in a show of support as the troops moved in, set up checkpoints, and roamed the streets. On mobile phone messages and through TV networks, the Defense Ministry urged people to support the army. It was not clear where the troops came from.
Essam al-Naas, spokesman of the Joint Operation Room, a security body under the prime minister, said that as the military deployed, militias from the western city of Misrata withdrew from four districts of the capital and returned to their city. Police forces also vowed to deploy around the city to keep security.
Sporadic gunfire was heard in eastern Tripoli, in an area called Wadi al-Rabie, when members of the Misrata militia fired on a Tripoli-based militia that was demanding they surrender their weapons before leaving, Naas said. There was no immediate report of casualties.
The army’s move came as the United States on Monday said it would train up to 8,000 Libyan soldiers, aiming to bolster the military. In Washington, Defense Department spokesman Colonel Steve Warren said the United States will train the troops in Bulgaria in basic, general-purpose skills.
Libyans’ anger was stoked when militiamen opened fire Friday on an antimilitia protest in Tripoli, killing at least 43 people. Protesters were demanding the removal of militias, raising signs reading, ‘‘The tyrant was killed and we won’t accept new tyrants.’’
The militia’s commander told local TV stations that there was a ‘‘third party’’ that opened fire to turn people against the militias. The next day, another militia attacked a military base, sparking clashes that killed four.
The violence prompted a three-day strike in Tripoli by residents to show anger at the militias and prompt the government to act. Frustration with the government and lawmakers has risen as well among Libyans who say they are too closely tied to the militias. On Monday, the second day of the strike, the city was quiet and only essential services such as bakeries, gas stations, and hospitals were open.
‘‘What we are witnessing is like a difficult labor,’’ lawyer and Tripoli resident al-Mahdi Ihmaid said of the new antimilitia push. ‘‘But if the government doesn’t make it this time, this could turn to another Iraq.’’
He said Tripoli protesters plan to march on more militia encampments in the city and there is a general call to topple the government and Parliament because of ties to militias, particularly among Islamic factions in Parliament such as the Muslim Brotherhood.
Gomaa al-Mashri, a security expert and former police officer, said he expects violence. But, he said, the popular uproar ‘‘will sweep out the government, the Parliament, and the militias all together and Libyans will start all over again.
‘‘The country is moving into the right direction. But this is the price we have to pay,’’ he said.
Libya’s militias originated in the ‘‘revolutionary’’ brigades that fought against Khadafy’s forces in the 2011 civil war.
Since Khadafy’s ouster and death, they have refused to disarm and have grown in size and power.