A recent bout of heavy fighting in the capital Tripoli has come to a halt after warring militias signed a new cease-fire agreement, Libyan authorities said Wednesday.

The U.N.-backed government said in a statement it welcomed the cease-fire agreement, which was brokered by local representatives and tribal leaders.

Fighting in Tripoli first erupted on Aug. 26 when the 7th Brigade comprised of militias hailing from Tarhouna, a town about 40 miles (60 kilometers) south of Tripoli, attacked southern neighborhoods of the capital.

The Tripoli Revolutionaries' Brigades and the Nawasi Brigade, militias which support the U.N.-backed government, came to the city's defense. Clashes flared up again last week, breaking a previous, U.N.-brokered cease-fire that began earlier this month.

At least 117 people, including civilians, have been killed in the fighting and another 404 wounded. Twenty people remain missing since fighting first began there, the Health Ministry said.

In the past two days, 1,700 families have been displaced due to renewed fighting, the U.N. aid agency said Tuesday. A total of 5,000 families have sought refuge with relatives in safer parts of Tripoli and its outskirts since Aug. 26, the U.N. Office for the Coordination of Humanitarian Affairs said.

"The clashes have led to a breakdown in basic services such as electricity and water," U.N. Humanitarian Coordinator Maria Ribeiro said.

Also on Wednesday, the U.N. envoy for Libya, Ghassan Salame, told the U.N. Human Rights Council that armed groups loyal to both the self-styled Libyan National Army, led by Field Marshal Kahlifa Hifter in the east, and the U.N.-backed-government in Tripoli continue to violate international law and human rights and use foreign mercenaries, especially in southern Libya.

"Impunity of armed groups must be challenged and all grave violations punished, sanctions imposed and perpetrators brought to national courts or the International Criminal Court," Salame tweeted.

He warned of "terror attacks on the rise, ISIS resurgent, with 57 dead in 14 attacks since year's start, including latest on the National Oil Cooperation headquarters in Tripoli."

Two people were killed and 10 others wounded earlier this month when suspected militants invaded the headquarters of Libya's national oil company, shooting randomly, setting off explosions and taking hostages, officials said.

The fighting in Tripoli underscored the country's lingering lawlessness more than seven years after the uprising that toppled and later killed longtime ruler Moammar Gadhafi. Libya is currently ruled by rival authorities in Tripoli and the east, each backed by an array of militias.