BANGKOK (AP) -- Thailand's Parliament elected 2014 coup leader Prayuth Chan-ocha as prime minister in a vote Wednesday that helps ensure the military's sustained dominance of politics since the country became a constitutional monarchy nearly nine decades ago.
The military-backed party that nominated Prayuth won the second-highest number of seats in the House of Representatives in a general election in March. But his selection was virtually assured because the prime minister is chosen in a joint vote of the 500-seat House and the 250-seat Senate, whose members were appointed by the junta Prayuth leads. Two House seats were vacant due to a suspension and resignation.
Prayuth was elected to serve a second term by a vote of 500 to 244 for his opponent, Future Forward party leader Thanathorn Juangroongruangkit. Prayuth, a former army commander, was the candidate of the military-backed Palang Pracharath party, which holds 116 House seats, as well as lawmakers from smaller parties. Prayuth's appointment becomes official when it is endorsed by King Maha Vajiralongkorn.
"The people are still calling for liberties. The people are still calling for justice," Thanathorn said after the vote. "This is not the time to lose hope. Hope is still on our side. Time is still on our side. I want to thank all 244 people who love democracy for voting for me."
Prayuth made no immediate public comment on the vote.
Prayuth did not run for office in the March election -- the constitution enacted under the junta he headed does not require that the prime minister come from Parliament. Laws passed under his government handicapped established political parties, raising concerns the election was not held on a level playing field. Critics also questioned the fairness of the Election Commission, alleging that rules were bent after the election to benefit Palang Pracharath.
The new election laws were aimed especially at the Pheu Thai party, which headed the government ousted by the 2014 coup and won the most House seats in March.
Pheu Thai is associated with former Prime Minister Thaksin Shinawatra, who was removed by a 2006 coup and lives in exile to avoid serving a prison term on a conflict of interest conviction he decries as politically motivated.
The populist policies of Thaksin won him enormous support at the polls but also threatened the influence of traditional power holders, including the military.
His following remained strong even after his ouster, and his sister, Yingluck Shinawatra, became prime minister in 2011, only to have her Pheu Thai government also toppled by the army in 2014.
Wednesday's vote indicates that Prayuth's coalition also has control -- by a small margin -- of the House, necessary to pass laws and approve budgets.
But there are doubts that a government led by Prayuth, used to governing by fiat, can fare well in a parliamentary framework.
"General Prayuth's return to the premiership has gone according to the ... junta's design. But managing a coalition government and a Parliament with a sizable opposition is very different from overseeing a military dictatorship," said Michael Montesano, coordinator of the Thailand Studies Program at Singapore's ISEAS-Yusof Ishak Institute.
"If observers are right and the new coalition proves too unstable to last more than a few months, the fear that another coup will pitch Thailand into an even bleaker situation is on the mind of many."
An open-ended parliamentary debate, with the two sides touting the merits of their candidate and the weaknesses of their opponent, pushed Wednesday's vote late into the night. The official result was announced just before midnight.
During the debate, Palang Pracharath lawmaker Koranis Ngamsukonrattana praised Prayuth for his character and his vision.
"He's patient and sacrificed himself so much for the country," he said. "He's the savior who came in and saved the country when all hope was lost."
Thanathorn's supporters attacked Prayuth as a destroyer of democracy.
"Coups are the ultimate crime against the rule of democracy with the monarch as head of state," said Piyabutr Saengkanokkul, secretary general of Thanathorn's Future Forward party. "It rips apart the entire constitution and takes power to rule over the country by establishing yourself as a 'sovereign' with the highest power."
It was a novelty for Thais to see such parliamentary battling after five years of army rule in which there was only a tame rubberstamp assembly.
While the formation of a government will finally return Thailand officially to civilian rule, it will be done under a new political system enacted by the junta Prayuth has led and its appointees. It is a system that critics say is meant to prolong rule by the military and its allies in the conservative establishment, rather than reflect the will of everyday Thais.
The Palang Pracharath coalition was opposed by the "Democratic Front," comprising seven anti-military parties led by Pheu Thai.
They nominated the charismatic young Thanathorn as their candidate for prime minister.
Future Forward, whose platform included strong opposition to military interference in politics, finished a strong third in the March election. Its unexpected performance has drawn it a raft of legal challenges from the military's supporters, and Thanathorn himself has been suspended from Parliament until the Constitutional Court decides whether be violated election law by allegedly holding shares in a media company.
Neither candidate was present for Wednesday's debate. Prayuth attended to official government business, while Thanathorn was absent from the assembly hall due to a court-ordered suspension that his supporters charge is politically motivated.