Pro-democracy party Pheu Thai, backed by former Prime Minister Thaksin Shinawatra, won a majority of seats in parliament in the first elections held in Thailand since a military coup five years ago, according to initial surveys released shortly after polling stations closed on Sunday.

Pheu Thai won between 163 and 173 of the 500 seats up for grabs in the lower house of parliament, ahead of the pro-army party Phalang Pracharat of current prime minister Prayuth Chan-ocha, which came in second with 96 seats, according to polls conducted by Super Poll and Suan Dusit.

The Democrat Party, the oldest in the country and which is supported by the upper middle classes as well as the military and royal elites, won between 77 and 88 seats, followed by the Bhumhaithai Party with between 40 and 59 seats, while the newly-formed Anakot Mai (“Future Forward”) party, which is hugely popular with younger voters, won between 40 and 49 seats.

The surveys were conducted at least 24 hours before the vote was held on Sunday, for which over 51 million people were eligible to vote for candidates representing over 80 parties.

It was still unclear if Pheu Thai would be able to form a coalition government with another pro-democracy party.

Sunday's elections were the first since a new constitution – adopted following the death of revered King Bhumibol Adulyadej in 2016 – limited the power of large parties and ensured that the military oversees a 20-year strategic plan, regardless of which party wins.

The constitution, approved with the promise of providing stability to the country and preventing a potential stalemate in parliament, also gives the military establishment powers to nominate all 250 members of the senate (the upper house) for a five-year term.

All 750 representatives from the two houses will vote together to elect the prime minister.

This means that a coalition of pro-democracy parties would require 376 seats in the lower house to be able to elect the next prime minister, while the pro-military parties need only 126, as it would be able to count on the support of the 250 military-appointed senators.

Official results were expected to be announced by the electoral commission at 8 pm, three hours after the polls closed.

Bhumibol's son and successor, King Maha Vajiralongkorn, made a surprise statement late on Saturday night, the eve of the polls, urging Thais to elect "good people" to rule and not prevent "bad people" from "creating chaos".

That announcement came just two months after a royal decree barred his eldest sister, Princess Ubolratana, from running as a candidate for prime minister.

The Thai Raksa Chart party, which is linked to the influential Shinawatra clan, had nominated the hugely popular and respected princess in an attempt to swing the vote against parties backed by the ruling military junta.

But after the King called the move "highly inappropriate," the party was dissolved by the electoral commission in a major blow to the Shinawatra clan.

Former PM Thaksin Shinawatra's enormous popularity is largely thanks to his approval of universal healthcare and soft loans for farmers in 2001 to alleviate inequality, which earned him massive support in rural areas and among the working classes.

Pitted against him were the wealthiest classes and the elites close to the monarchy and the army, who ousted him in 2006 and toppled the government of his younger sister, Yingluck Shinawatra, in 2014.

Both siblings were now living in self-imposed exile after being found guilty in absentia of corruption and sentenced to prison.

Sunday was the first time Thais had the chance to vote since the 2014 coup, which was led by current PM General Prayuth.