Libya’s ruling council handed over power to a newly elected national assembly on Wednesday in the North African country’s first peaceful transition of power in its modern history but which comes amid heightened violence.

In a late-night ceremony held under tight security in Tripoli, the National Transitional Council (NTC), political arm of the opposition forces that toppled Muammar Gaddafi a year ago, handed over to the national congress, elected in July.

NTC Chairman Mustafa Abdel Jalil symbolically passed on the reins to the oldest member of the new 200-member assembly, Mohammed Ali Salim.

“The National Transitional Council hands over the constitutional duties for leading the state to the general national congress, which from now on is the sole legitimate representative of the Libyan people,” Jalil said to loud cheers.

In a speech, Jalil, who announced he would retire after ending his NTC chief post, acknowledged “mistakes” had been made during an “extraordinary” transitional period and said security and disarmament issues had not been resolved in time.

The congress, whose members took an oath led by Salim, will now name a new chairman while the NTC will be disbanded. A first meeting was scheduled after the ceremony.

Large crowds gathered in Tripoli’s Martyrs Square to celebrate the handover as fireworks lit up the sky.

The assembly will name a new prime minister who will pick his government, pass laws and steer Libya to full parliamentary elections after a new constitution is drafted next year.

A liberal coalition led by wartime rebel prime minister Mahmoud Jibril won 39 of the 80 party seats in the congress, while its Islamist rivals, the Justice and Construction Party – the political wing of the Muslim Brotherhood – won 17.

However the remaining 120 seats are in the hands of independent candidates whose allegiances are hard to pin down.

In the battle to hold sway over the assembly, where key decisions will require a two-thirds majority, Jibril’s National Forces Alliance and the JCP are scrambling to form alliances with independents and smaller parties.

Some independents, distrustful of both sides, have spoken of forming their own coalition.

SECURITY PROBLEMS

Getting a grip on security in an often anarchic post-Gaddafi Libya will be the priority for the country’s new rulers, Deputy Prime Minister Mustafa Abu Shagour earlier told Reuters.

The run-up to the transition has been overshadowed by several violent incidents in the past week that have shown the country’s precarious stability.

These include a car bomb in Tripoli near the offices of the military police and an explosion at the empty former military intelligence offices in the eastern city of Benghazi, the cradle of the revolt against Gaddafi.

“Clearly they worry us, but at the same time we are investigating them. We are trying to find out who is behind this,” Abu Shagour said. “We were able to improve security from when we started, but there’s still a way to go. Security is top of the agenda for whomever will be coming into power.”

The interim authorities that took over after Gaddafi’s overthrow s uccessfully led Libya to the elections. But the government has struggled to impose its authority on a myriad of armed groups who refuse to lay down their weapons.

On Sunday, security forces killed three armed men suspected of being behind seven failed bomb plots. That same day, the International Committee of the Red Cross suspended its work in Benghazi and the port city of Misrata after one of its compounds was attacked with grenades and rockets.

This followed the kidnapping of seven Iranian aid workers by armed men in Benghazi on July 31.

Still, Abu Shagour expressed optimism that the problems could be overcome. “I don’t think it is going to get worse, I think things will get better as we move on. Our security forces are getting better,” he said.

The date of the handover is symbolic – corresponding to 20 Ramadan, the Muslim fasting month, in the Islamic calendar. Last year, 20 Ramadan was Aug 20 – when rebels overran Tripoli, forcing Gaddafi to flee.