Libya's national assembly gave its approval on Wednesday to a cabinet presented by prime minister designate Ali Zeidan weeks after rejecting his predecessor's line-up.
But in a sign of the fragility of the country's transition to democracy a year after the overthrow of veteran dictator Moamer Kadhafi, protests erupted around the assembly building for a second day in a row.
Zeidan, the second premier designate to try to form a government since the assembly was elected in July, had presented a 30-member line-up including both liberals and Islamists.
"The General National Congress gives its confidence to the government of Ali Zeidan," the official LANA news agency reported.
A total of 105 members voted in favour, 18 abstained and nine voted against.
Protests erupted outside the assembly moments after the vote, witnesses said.
Security forces fired in the air as they struggled to prevent a repetition of chaotic scenes on Tuesday evening when demonstrators broke into the chamber derailing a first attempt at a vote.
"There are demonstrators outside the building and security forces are trying to keep them at bay," said Salah Mohammed Hassan, a representative from the eastern town of Darna.
More than a dozen security vehicles were stationed at the assembly building and a throng of about 60 people had gathered outside the main gate which was shut tight, an AFP photographer reported.
"The blood of our martyrs was not spilled in vain," chanted some, while others said they had come to air their objections to some of the ministers.
There were no visible efforts to negotiate with the crowd but a security source contacted inside the building said the situation was "under control" and that assembly members had managed to leave the building after the session.
Zeidan was elected on October 14 after his predecessor, Mustafa Abu Shagur, was dismissed in a vote of no confidence as the assembly rejected his proposed line-up as unrepresentative of Libya's numerous factions.
Signup to our newsletter and follow us on Facebook and Twitter!
Zeidan, a long-time Kadhafi opponent, needed the assembly's approval for his cabinet line-up so that he can assume office replacing Abdel Rahim al-Kib, who has served as prime minister since November last year.
No date has yet been set for his formal swearing-in.
Assembly members can still put forward objections to individual cabinet nominees and the suitability of several has already been called into question, assembly sources said.
Zeidan's programme puts heavy emphasis on reforming the army and police, which remain heavily dependent on the myriad of former rebel militias that have yet to be brought under unified command since last year's uprising.
The militias are particularly powerful in second city Benghazi, cradle of the rebellion, where jihadist sympathisers stormed the US consulate on September 11, killing Ambassador Chris Stevens and three other Americans.
Zeidan won his post thanks in large part to the backing of the liberal National Forces Alliance, the biggest party in the assembly, but he said on Tuesday that he had reached out to all the main political factions in forming his government.
He said that he had decided to put independents in charge of key ministries such as foreign affairs, international cooperation, finance, justice, interior and defence.
Among his nominees are former fighter pilot Mohammed al-Barghathi as defence minister and Ashur Shwayel as interior minister. Both are natives of Benghazi.
Zeidan named Ali Aujli, Libya's ambassador to the United States, as foreign minister and Abdelbari al-Arussi, a native of the western town of Zawiyah, to head the strategic oil ministry.
He also proposed creating a new ministry of tourism in the conservative Muslim country that bans alcohol but boasts spectacular Greco-Roman ruins and beaches. It is to be headed by Ikram Bash Imam, one of two women in the line-up.
The chief task of the new government is organising fresh elections within 12 months on the basis of a new constitution, which has yet to be drafted.
A 62-year-old career diplomat, Zeidan defected in 1980 while he was serving at the Libyan embassy in India, and spent the next three decades in exile.
He played a major role in winning international recognition for the rebel leadership during last year's uprising which saw the rebels vanquish Kadhafi's forces with the UN-endorsed support of NATO.