Libyan's army moved into Benghazi in eastern Libya on Friday, a show of force aimed at restoring order in the country's second largest city, rocked by almost daily bombings and assassinations.
Security in the port city, an important part of Libya's oil infrastructure, has deteriorated in the past few months with armed militants and radical Islamists roaming unchallenged, highlighting the anarchy in the OPEC producer two years after the fall of Muammar Gaddafi.
Most countries have closed their consulates in Benghazi after a series of attacks and some foreign airlines have stopped flying there. The U.S. ambassador was killed in September 2012 during an Islamist assault on the consulate.
Stability in the region is key for oil supplies as around 60 percent of oil production comes from the country's eastern half.
Hundreds of armoured troop carriers and army trucks mounted with guns drove through the old city near the Corniche after Friday prayers, cheered by residents tired of violence, witnesses said.
"We stand by the people," Wanis Bukhmada, commander of special forces in Benghazi, told a crowd. "We won't allow anyone to mess around with security anymore."
Some 500 people took to the streets, welcoming the army, which has been accused by critics of keeping largely to barracks in recent months.
"We are with the army. There is no security without the army," political activist Hania al-Gumati told Reuters during the demonstration.
But hours later unknown gunmen killed a security officer in Benghazi, a security source said.
Authorities reinforced the city with special forces in June after some 40 people were killed in clashes between rival militias, which helped bring down Gaddafi but kept their guns after the NATO-backed revolt.
Western powers worry that instability in Benghazi will spill over to the capital Tripoli, which saw the worst fighting between militias this week.
Three militiamen were killed during heavy fighting between rival groups with anti-aircraft guns and grenades on Thursday night, Sadat el-Badri, head of the local council told Reuters.
He said authorities would undertake "decisive action" to stop militia fighting but analysts are sceptical as the weak government of Prime Minister Ali Zeidan struggles to control much of a country awash with arms.
Protests and strikes over higher pay and political rights have shut down much of the country's oil output, depriving the government of the main source of income.