Nearly five years after a coup, Thailand voted Sunday in a long-delayed election setting a military-backed party against the populist political force the generals overthrew. Prime Minister Prayuth Chan-ocha, the blunt-speaking army chief who led the 2014 coup, is hoping to extend his hold on power after engineering a new political system that aims to stifle the influence of big political parties not aligned with the military. Voting stations closed at 5 p.m. and meaningful results were expected within several hours, but the formation of a new government could take weeks of haggling. About 51 million Thais were eligible to vote. Leaders of political parties opposed to military rule urged a high turnout as the only way to derail Prayuth's plans. Prayuth was among the first to vote in Bangkok, the capital, arriving in a black Mercedes after polling booths opened at 8 a.m. 'I hope everyone helps each other by going to vote today as it's everyone's right,' he told reporters after voting. He played golf later in the morning before heading to an army base to await results. The election is the latest chapter in a nearly two-decade struggle between conservative forces including the military and the political machine of former Prime Minister Thaksin Shinawatra, a tycoon who upended tradition-bound Thailand's politics with a populist political revolution. Thaksin was ousted in a 2006 military coup and now lives in exile abroad to avoid a prison term, but parties allied with him have won every election since 2001. His sister, Yingluck Shinawatra, who led the government that was ousted in 2014, also fled the country after what supporters said was a politically motivated corruption prosecution. After the coup, political party gatherings were banned and pro-democracy activists and other dissenters were regularly arrested, interrogated and imprisoned. Just days before Sunday's election, the Thaksin-allied Pheu Thai party said the houses of party officials and its campaign canvassers in some provinces were searched by military personnel in an act of intimidation. The party's leader, Sudarat Keyuraphan, said after voting in Bangkok's Ladprao district that she was confident of winning. 'I don't say it'll be a landslide. I don't know. Depends on the people. But I think we can win this election,' she said. Thailand's powerful King Maha Vajiralongkorn issued a statement on the eve of the election that said the role of leaders is to stop 'bad people' from gaining power and causing chaos. It was also broadcast on Thai television stations minutes before voting started. Invoking a speech by his father, the previous Thai king who died in 2016 after reigning for seven decades, Vajiralongkorn said not all citizens can be transformed into good people so leaders must be given support in ruling to create a peaceful nation. He urged government officials, soldiers and civil servants to look after national security. It was the monarch's second notable intervention in politics recently. Last month, he demanded his sister Princess Ubolratana Mahidol withdraw as a prime ministerial candidate for a small Thaksin-allied party within 24 hours of her announcement. First-time voter Napasapan Wongchotipan said she hopes for positive changes after the election. 'I have no idea what the results will be like,' she said. 'But I do wish that the party that we will get, the party that wins the votes, will come in and improve our country.' Thais were voting for a 500-seat parliament that along with a 250-member junta-appointed Senate will decide the country's next prime minister. That setup means a military-backed figure such as Prayuth could become leader even while lacking a majority in parliament. 'The biggest challenge of this election is whether it will mark the beginning of a transitional democracy in Thailand. I hope to see that, but it seems to be a very dimmed hope,' said Siripan Nogsuan Sawasdee, a political scientist at Bangkok's Chulalongkorn University. 'It might end up with the election being used as a façade for a new authoritarian ruler or we might end up with another round of conflicts and polarization,' she said. Political parties and their main leaders held their final major rallies on Friday evening in Bangkok. Sudarat said Pheu Thai would fight to overcome constitutional hurdles erected against it by Prayuth's regime. 'In 2014, they took power with the barrel of a gun, by a coup,' she said. 'In 2019, they are trying to take away the people's power again through crooked regulations under the constitution.' When it seized power in 2014, the military said it was to end political unrest that had periodically turned violent and disrupted daily life and the economy. The claim has been one of the few selling points for the gruff Prayuth, who according to critics has overseen a period of growing inequality and economic hardship in Thailand. 'I want things to improve,' Narate Wongthong said after voting. 'We had too many conflicts in the past and I want to see lots of people come out and vote.' ___ Associated Press journalists Preeyapa T. Khunsong, Hau Dinh and Tassanee Vejpongsa contributed to this report.