* Chaotic session ends with discord over new premier
* Analysts see appointment unlikely to ease turmoil
* Libya struggled to democracy since 2011 civil war (Adds details, quotes)
By Ahmed Elumami and Feras Bosalum
TRIPOLI, May 4 (Reuters) - Businessman Ahmed Maiteeq was sworn in as Libya's new prime minister on Sunday after chaotic voting, with several lawmakers challenging an appointment seen by analysts as unlikely to ease the oil producer's political turmoil.
Officials gave contradicting versions of the parliamentary election outcome, with a deputy speaker initially saying Maiteeq had failed to obtain the necessary quorum even through he emerged as frontrunner in several prior votes.
However, second deputy speaker Saleh Makhzoun later said he had won the necessary support and asked him to form a new government within two weeks.
"Ahmed Maiteeq is officially the new prime minister," Makhzoun told a televised session interrupted by shouts from lawmakers challenging his win.
Analysts expect Maiteeq to struggle to make headway as government and parliament are unable to impose authority on a country awash with arms and militias, both a legacy from the NATO-backed 2011 uprising which toppled Muammar Gaddafi.
Since the civil war that ended Gaddafi's one-man rule, Libya's nascent democracy has struggled, with its parliament paralysed by rivalries and brigades of heavily-armed former rebels challenging the new state.
The premier's post became vacant after Prime Minister Abdullah al-Thinni resigned three weeks ago, citing an attack by gunmen on his family just a month into his term.
Parliament began voting on his successor on Wednesday, but that session was postponed after gunmen linked to a defeated candidate stormed the building and wounded several people.
Lawmakers resumed voting on Sunday in a frequently interrupted session, marked by confusion over the number of votes cast for Maiteeq. Some questioned the legitimacy of his election.
"The vote ... to appoint him as the prime minister was totally invalid," said lawmaker Zainab Haroun Al-Targi.
Thinni's short-lived tenure followed that of Ali Zeidan who fled the country after he was fired by deputies over his failure to stop attempts by rebels in the volatile east to sell oil independently of Tripoli's government.
Libya's assembly is deadlocked between Islamists, tribes and nationalists, as the country's fledgling army tries to assert itself against unruly ex-rebels, tribal groups and Islamist militants.
In February, it agreed to hold early elections in an effort to assuage Libyans frustrated at political chaos nearly three years after the fall of Gaddafi.
Many people in the OPEC nation blame congressional infighting for a lack of progress in the transition to democracy. Libya still has no new constitution.
Assembly president Nouri Abu Sahmain was absent from the vote. He has disappeared from public view since the attorney general launched an investigation into a leaked video showing him being questioned over a late-night visit by two women to his house. (Reporting by Ahmed Elumami, Feras Bosalum and Ulf Laessing; Writing by Ulf Laessing; Editing by Patrick Markey and Sophie Hares)