BANGKOK (Reuters) - Thailand’s new parliament confirmed military junta leader General Prayuth Chan-ocha as civilian prime minister on Wednesday, five years after he seized power from an elected government while he was army chief.

Thai parliament members attend a session to vote for prime minister in Bangkok, Thailand June 5, 2019. REUTERS/Soe Zeya Tun

The 500-244 vote came after a March 24 general election that opposition parties say was designed to extend and legitimize military dominance over government.

After a marathon day of debate, the now-retired army chief secured the 375 votes needed to become premier in a combined ballot by both houses of parliament, one of which was entirely appointed in a process controlled by the junta.

Prayuth - who was not present for the vote - easily defeated Thanathorn Juangroongruangkit, a charismatic political newcomer who was nominated by the opposition Democratic Front, which comprises seven parties that want to remove the military from politics.

Prayuth will now lead an unwieldy 19-party coalition government that has a slim majority in the lower House of Representatives, but could be vulnerable to defections and infighting.

Opposition lawmakers argued for hours that Prayuth was unfit for office.

“He (Prayuth) came to power in a coup, then comes in and completely changes the rules and conditions that allows him to stay on and transform himself into a prime minister candidate,” said Chonlanan Srikaew of the opposition Pheu Thai party.

Slideshow ( 9 images )

However, the electoral rules of the 2017 post-coup constitution made it nearly impossible for the opposition to overcome the 250 votes of the Senate.

And Prayuth’s Palang Pracharat party said he deserved to stay in power for bringing an end to repeated paralyzing street protests by opponents and supporters of exiled former prime minister Thaksin Shinawatra, who was ousted in an earlier coup in 2006.

“Prayuth has stepped in to solve the conflict ... and showed a great deal of leadership. He has been decisive possibly more than other past leaders,” said Palang Pracharat lawmaker Koranit Ngamsukonrattana.

The Democratic Front is led by Pheu Thai, which was ousted from power in 2014 and is allied to Thaksin, whose affiliated parties had until this year won every election since 2000.

In March, Pheu Thai won the most seats in the 500-seat elected House of Representatives. Prayuth’s Palang Pracharat party came second and Thanathorn’s Future Forward Party third.

After the preliminary results of the March election, the Democratic Front projected that it had won a majority in the House.

However, the election commission later announced a change in a seat-allocation formula that gave 10 small parties one seat each, mostly at the expense of Thanathorn’s Future Forward Party. The 10 small parties joined Prayuth’s alliance.

Uttama Savanayana, leader of Palang Pracharat, put a posting on his Facebook site after Wednesday’s vote saying the party “will look after the people and continue to lead Thailand forward”.

Thanathorn told reporters outside parliament that his party would continue to work to end military dominance.

“Today we did not lose. But because of the rules we have been robbed of victory,” he said. “If we continue to go forward strongly, one day they will lose.”