Tripoli (CNN) -- After a chaotic day that saw Libya pick a new prime minister only for the vote be declared invalid hours later, the volatile North African country appears to have a new premier -- the fifth in more than two years.
The General National Congress, Libya's transitional parliament, seemed to have selected a new prime minister on Sunday, choosing businessman Ahmad Mitig during a lively legislative session that saw several rounds of voting.
But almost as soon as Mitig was sworn in, the deputy speaker declared the election invalid.
On Monday, the Congress confirmed Mitig as Libya's new prime minister after approving his appointment.
"Ahmad Mitig was appointed head of the transitional government, and asked to form his cabinet and present it to the GNC for a confidence vote within 15 days," said a decision signed by Congress Speaker Nuri Abu Sahmein.
"This decision is in effect from date of publication ... and anything that contradicts it is nullified and all those concerned must implement it."
The resolution was numbered as "No. 38" and dated May 4 but published Monday.
Given Sunday's dispute, it was unclear what exactly would happen next.
The appointment makes the 42-year-old businessman Libya's fifth and youngest premier since dictator Moammar Gadhafi was toppled and killed in a 2011 revolution.
But the confusion was another blow to a transitional government that has struggled to impose its authority over myriad militia groups that have grown in power and influence since the NATO-backed uprising.
Parliament's work has been undermined by internal squabbling and threatened by the North African country's fractious militias, many of whom fought to oust Gadhafi but have refused to lay down their arms.
Sunday's vote was the latest in several attempts to choose a prime minister. Another vote was abandoned last week when armed men stormed congressional headquarters, sending lawmakers fleeing.
It took two rounds of voting before Mitig emerged as the front-runner for the post on Sunday, but he fell short of the 120 votes required in a confidence vote.
A power struggle soon erupted in the assembly, with officials giving contradictory versions of the outcome.
Second Deputy Speaker Saleh al-Makhzoum said Mitig had clinched 121 votes after voting resumed. But First Deputy Speaker Ezzedin al-Awami, who had chaired the first vote, said it was illegal, as he had already declared the session over. Both men could be seen arguing in the chamber on television.
Al-Awami took the role of acting speaker during Sunday's session. Abu Sahmein, who usually chairs parliamentary sessions, disappeared from public view after the prosecutor general reportedly launched an investigation into a leaked video showing him being questioned over a late-night visit by two women to his house.
The premier's post became vacant after interim prime minister Abdullah al-Thinni resigned last month, citing an attack by gunmen on his family just a month into his term. He continued as caretaker premier until his successor was picked.
He had taken over from Ali Zeidan, who fled the country after he was ousted by deputies over his failure to stop attempts by rebels in the volatile east to sell oil independently of Tripoli's government.
Many Libyans in the oil-producing nation blame political infighting for a lack of progress in Libya's fragile nascent democracy after more than 40 years of one-man rule.
A new constitution is in the works -- a process that has been repeatedly delayed by political wrangling -- but many are increasingly frustrated with the lack of economic progress and deteriorating security.
To appease the rising popular discontent, the Congress has agreed to hold early elections this year for a new legislature that would also produce a new government.