A ceasefire has been signed between armed factions fighting over the Libyan capital, the United Nations said on Tuesday, after more than a week of violence inside Tripoli. Dozens of people have been killed in fighting engulfing Tripoli as rival armed groups vie for power and money in the chaos persisting in the oil producer since the toppling of Muammar Gaddafi in 2011. “A ceasefire agreement was reached + signed today to end all hostilities, protect civilians, safeguard public and private property,” the UN mission in Libya (UNSMIL) said in a statement. Tripoli’s only functioning airport, Matiga, would also be reopened after being closed since Friday, the United Nations said, without giving any details beyond the text of the agreement. Commanders of some factions could be seen on pictures published by UNSMIL, while others seemed to have been absent. It was not clear how the ceasefire would be implemented as militias have ignored previous calls to lay down arms by the UN-backed government which is largely powerless. One armed faction, the 7th brigade from Tarhouna town south of the capital, which had attacked Tripoli with other factions, accepted the ceasefire, spokesman Saad al-Hammali said, Last week, local officials brokered a ceasefire that did not hold. There is no police or army or functioning state to enforce peace in a country ruled by armed groups who defy authority and form flexible alliances. Tripoli is formally controlled by the internationally recognised Government of National Accord, but armed groups working with it act with autonomy. Eastern Libya is controlled by a rival administration. “Today does not aim to fix all the Libyan capital’s security problems; it seeks to agree on a broader framework on the way to start addressing the issues,” UNSMIL quoted U.N. Special Envoy Ghassan Salame as saying. The fighting had started because armed groups outside Tripoli had opposed a cartel of four “super militias” controlling access to state funds and foreign currency at huge discount from the central bank. Migrants In a sign of the chaos, hundreds African migrants escaped from a detention centre caught in the middle of a shootout, an aid official said. A video posted on social media purported to show hundreds of Africans, some carrying plastic bags, walking in a long line away from the detention centre. As many as 1,900 migrants had been in the detention centre but some were brought by authorities to another facility, a U.N. official said. Some ended up on a farm. “Five people got shot (there), one got shot when we came here,” said Omar Abdullah, a migrant from Eritrea. “We didn’t have a shower for three, four days.” Libya is a major departure point for migrants crossing the Mediterranean Sea to Europe, mainly from other parts of Africa. Most migrants had been jailed after the Libyan coastguard intercepted their makeshift boats bound for Italy. Some 400 prisoners also escaped on Sunday from a jail in southern Tripoli. More than 1,800 families have been displaced from their homes since the start of the fighting, a report by the Tripoli-based ministry for displaced people said.