Bangkok (CNN) Thailand's main opposition party has won more seats than anyone else in the country's parliament -- in the first election since a military coup five years ago -- but it won't get to choose the country's next leader.

Pheu Thai took 136 seats, according to official figures released Wednesday, while the pro-military Palang Pracharat party took 115. Pheu Thai is aligned with former Prime Minister Thaksin Shinawatra, whose allies were ousted in the 2014 coup.

Based on the official tally, Pheu Thai and its coalition partners appear to have taken a total of 245 of the 500 seats in the lower house, six short of a majority.

But that won't be enough to form a government or choose the next prime minister. That decision is made by both houses of Parliament, and the country's 250-seat Senate is chosen entirely by the military, which will almost certainty vote to keep junta leader Prayut Chan-o-cha in office.

Thai Prime Minister Prayut Chan-O-Cha speaks during a joint news conference with his Malaysian counterpart at the Government House in Bangkok on October 24, 2018.

Critics have complained that the odds were stacked against the opposition from the start in a vote seen as a contest between a pro-military bloc that wants to keep power and pro-democracy forces.

Read More