Libya's national assembly has picked former opposition leader Mohammed Magarief as its president as the North African country's newly elected congress began its rule.
Magarief, leader of the National Front party, will head the 200-member congress, which will name a prime minister, pass laws and steer Libya to full parliamentary elections after a new constitution is drafted next year.
Magarief, seen as a moderate Islamist, is effectively Libya's acting head of state, but the true extent of his powers is yet to be determined.
A former diplomat who had lived in exile since the 1980s, Magarief was a leading figures in Libya's oldest opposition movement - the National Front for the Salvation of Libya - which made several attempts to end the late Muammar Gaddafi's rule.
Magarief's National Front Party is an offshoot of the old opposition movement and it won three seats in the July 7 poll for the national assembly - Libya's first free vote in a generation.
"I am very very happy. This is a big responsibility," he told Reuters.
Magarief won 113 votes versus independent Ali Zidan who secured 85 votes. Voting went to a second round after no one managed to win an outright majority in the first round.
"This is democracy, this is what we have dreamt of," Zidan told Reuters, congratulating Magarief.
The assembly was also set to pick two deputies for Magarief, who had been seen as a leading contender for the top job.
"He is a political personality and everybody knows him." said Othman Sassi, a former official of the National Transitional Council. "He has very good experience to lead congress and the Libyan democratic state."
The national assembly began life on Wednesday after it took power from the National Transitional Council, the political arm of the opposition forces that toppled Gaddafi a year ago and which has now been dissolved.
The late-night ceremony was the first peaceful transition of power in Libya's modern history but it has been overshadowed by several violent incidents in the past week that have underscored the country's precarious stability.
These include a car bomb near the offices of the military police in the capital, Tripoli, and an explosion at the empty former military intelligence offices in the eastern city of Benghazi, the cradle of the revolt against Gaddafi.
In the new assembly, 80 seats are held by parties. A liberal coalition led by wartime rebel prime minister Mahmoud Jibril won 39 of those seats, while the Justice and Construction Party - the political wing of the Muslim Brotherhood - won 17.
The remaining 120 seats are in the hands of independent candidates whose allegiances are hard to pin down.