* Chaotic session ends with discord over new premier
* Analysts see appointment unlikely to ease turmoil
* Libya has struggled politically since 2011 war (Adds cabinet spokesman In paragraph 9)
By Feras Bosalum and Ulf Laessing
TRIPOLI, May 4 (Reuters) - Businessman Ahmed Maiteeq was sworn in as Libya's new prime minister on Sunday after chaotic voting in parliament, but hours later the deputy speaker declared the election invalid as a power struggle erupted in the assembly.
The divisions in the assembly showcase growing turmoil in the North African country awash with arms and militias from the 2011 ouster of Muammar Gaddafi, where government and parliament are unable to assert authority.
Officials gave contradicting versions of the parliamentary election outcome, with First Deputy Speaker Ezzedin al-Awami initially saying Maiteeq had failed to obtain the necessary quorum even through he had emerged as front-runner in prior votes.
But a power struggle over who controls the assembly broke out when Saleh Makhzoum, second deputy speaker, rejected Awami's assertion and said Maiteeq had won the necessary support.
"Ahmed Maiteeq is officially the new prime minister," Makhzoum told a televised session interrupted by shouts from lawmakers challenging Maiteeq's win. He asked the businessman to form a government within two weeks.
Hours later, Awami declared the vote invalid and instructed Abdullah al-Thinni, who had resigned three weeks ago, to continue ruling the major oil producer.
"Mr Ahmed Omar Maiteeq failed to reach the quorum of 120 votes necessary according to the law to elect a new prime minister," Awami wrote in a letter to Thinni posted on the cabinet website.
It was unclear what would happen next as the two speakers argued with each other live on al-Ahrar television, with Makhzoum insisting Maiteeq had been elected. "From a legal point of view the vote process was right and clear," he said.
Cabinet spokesman Ahmed Lamin, asked by Reuters what Thinni planned to do, said the government would implement any instructions from parliament according to the constitutional principles. He did not elaborate.
Political analysts expect Maiteeq, if confirmed, to find it difficult to make headway in easing the turmoil in the country.
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 Thinni resigned, 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.
"The vote ... to appoint him as the prime minister was totally invalid," said lawmaker Zainab Haroun Al-Targi, echoing the views of many colleagues.
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 parliament, the General National Congress, 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 the political chaos.
Many people in the OPEC nation blame congressional infighting for a lack of progress in the transition to democracy. Libya still does not have a 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.
In the south, tribesmen ended a two-month protest at the key El Sharara oilfield but output will only resume after a separate protest at a connecting pipeline is resolved, an oil official said on Sunday.
A wave of protests by militias, tribesmen and state security guards at oilfields and ports has reduced oil output to a trickle from 1.4 million barrels per day in July. (Reporting by Ahmed Elumami, Feras Bosalum and Ulf Laessing; Writing by Ulf Laessing; Editing by Patrick Markey, Stephen Powell, Marguerita Choy and Mohammad Zargham)
Our Standards: The Thomson Reuters Trust Principles.