Voting has closed in Thailand's general election, where the daughter of ousted former prime minister Thaksin Shinawatra is the frontrunner.
The election is being described as a turning point for a country that has experienced a dozen military coups in its recent history.
Prime Minister Prayuth Chan-ocha, the army general who led the last coup in 2014, is seeking another term but is facing a strong challenge from two anti-military parties.
Vote counting got under way after polls closed at 5pm on Sunday. Voting began at 8am at the 95,000 polling stations across the country.
About 50 million people were expected to cast their ballots to elect 500 members of the lower house of parliament and some two million people had voted early.
A preliminary vote count showed the Pheu Thai Party (For Thais) was ahead with 6.45 percent of eligible votes, followed by another opposition party Move Forward.
Leading the race is Pheu Thai, led by Thaksin's daughter Paetongtarn Shinawatra.
The 36-year-old is harnessing her father's wide patronage network while sticking to the populist message that has resonated with rural, low-income regions of the country.
Thaksin, a telecommunications billionaire, is loved by many lower-income Thais, but is deeply unpopular with the royalist elite. He was ousted in a military coup in 2006, when his opponents accused him of corruption. He has denied the allegations and has since been living in exile since 2008 in London and Dubai.
"I think after eight years, the people want better politics, better solutions for the country than just coups d'etat," Paetongtarn told the BBC in a recent interview.
Move Forward, led by Pita Limjaroenrat, a 42-year-old former tech executive, has also been rising fast in opinion polls. Its young, progressive and ambitious candidates have been campaigning on a simple but powerful message: Thailand needs to change.
"And the change is really not about having another coup. Because that's a change backwards. It's about reforming the military, the monarchy, for a democratic future, with better economic performance," says Thitinan Pongsudhirak, from the Institute of Security and International Studies at Chulalongkorn University.
Meanwhile, Prayuth, 69, is lagging in opinion polls. He seized power from the government of Thaksin's sister, Yingluck Shinawatra, in 2014, following months of turmoil.
Thailand held an election in 2019, but the results showed no clear party had won a majority.
Weeks later, a pro-military party formed the government and named Prayuth as its PM candidate in a process that the opposition said was unfair.
The following year a controversial court ruling dissolved Future Forward, the previous iteration of Move Forward, which had performed strongly in the election thanks to the passionate support of younger voters.
That sparked off mass protests lasting 6 months which called for reform of the military and the monarchy.
With nearly 70 parties contesting this election, and several large ones, it is unlikely any one party will get an outright majority of the seats in the lower house.
But even if one party does win a majority, or has a majority coalition in place, the political system bequeathed by the military-drafted 2017 constitution, and a range of other extra-electoral authorities, can prevent it from taking office.
The constitution, written while Thailand was under military rule, created a 250-seat appointed senate, which gets to vote on the choice of the next PM and government.
As the senators were all appointed by the coup leaders they have always voted in favour of the current, military-aligned government, and never in favour of the opposition.
So technically any party without the senate's backing would need a super-majority of 376 out of the 500 seats, an unobtainable target.