* Eight of 27 ministers are no-shows, underlining disarray
* Swearing-in proceeds to expedite tackling of Libya's woes
By Marie-Louise Gumuchian and Ali Shuaib
TRIPOLI, Nov 14 (Reuters) - Libya's first elected government was sworn in under tight security on Wednesday, inheriting the daunting task of establishing democracy in a country plagued by rival militias who helped overthrow Muammar Gaddafi last year.
In a national congress hall built by Gaddafi shortly before his fall, new cabinet ministers swore an oath to protect the North African state, a major oil producer.
"I swear to God that I will fulfil my duties with all dedication to be loyal to the goals of the 17th of February Revolution, and to respect the constitution and its rules and its articles and to completely care for the needs of Libyans and to protect the Libya and the unity of its lands," each minister intoned from a podium.
In a continued sign of disarray, eight of the 27 ministers nominated by Prime Minister Ali Zeidan did not show up after some members of the elected congress queried their credentials.
Ministers in charge of electricity, higher education, relations with congress and interior were rejected by the North African state's integrity commission because of questionable backgrounds, including alleged ties with the Gaddafi regime.
Rulings on four other cabinet nominees - foreign affairs, agriculture, social affairs, and religious affairs - were pending.
"The country cannot suffer delays any more so we needed to swear in this government and hand it power," said congress member Mohamed al-Hudeiri. "Pending a decision by the commission, these portfolios will be handled by the deputy ministers until we find replacements for them."
Libya's national assembly approved Zeidan's proposed government on Oct. 31 after rejecting his predecessor's line-up.
But the list of members sparked violent protests outside the congress, forcing it to adjourn early.
Former rebel militias gathered with weapons outside the building, shooting in the air and at one point tried to storm into the congress' building, demanding the removal of those members they accused of being old Gaddafi loyalists.
To avoid similar violent outbursts on Wednesday, Libyan national army forces cordoned off the congress headquarters, standing guard with pick-up trucks mounted with anti-aircraft weapons. Sniffer dogs were also deployed.
Aware of Libya's sharp regional tensions, Zeidan had said he had tried to strike a geographic balance among his 27 ministers.
He nominated Ali Aujali, Libya's ambassador to the United States, as foreign minister; Mohammed al-Barghathi, who served in the Libyan air force, as defence minister; and Abdelbari al-Arusi, from the western town Zawiyah, as oil minister.
A former diplomat who defected in the 1980s to become an outspoken Gaddafi critic, Zeidan will govern the country while the congress, elected in July, passes laws and helps draft a new constitution to be put to a national referendum next year.
Congress elected Zeidan prime minister this month after his predecessor, Mustafa Abushagur, lost a confidence vote over his choice of ministers.
Fighting in Tripoli earlier this month between competing militias underlined the challenges Libya's first freely elected government faces in overcoming clan, regional and sectarian divisions standing in the way of modernisation. (Writing By Hadeel Al-Shalchi)