Millions of Cambodians voted in local polls on Sunday, testing the political temperature of a country rife with tension between its strongman premier and an embattled opposition determined to end his three-decade rule.

Prime Minister Hun Sen, one of the world's longest serving leaders, has run Cambodia for 32 years.

Supporters see the 64-year-old as a beacon of stability while detractors accuse him and a coterie of allies of huge self-enrichment, corruption and autocracy.

Sunday's vote in more than 1,600 communes -- village clusters -- is viewed as a warm-up for next year's national elections.

But the opposition has been hammered by a crackdown in recent months, with critics jailed and the main political rival to Hun Sen fleeing overseas to escape charges.

‘I voted for a change, I want to try new leaders,’ Tara, a 30-year-old garment factory worker, told AFP after casting her vote for the opposition Cambodian National Rescue Party (CNRP) at a polling booth in the capital.

‘I want the country to be more progressive, I want mutual respect for human rights,’ she added.

Hun Sen cast his ballot shortly after polls opened at 7am (0000 GMT) in Takhmao, a town on the outskirts of Phnom Penh where he has a residence and a nearby bodyguard unit stationed.

He declined to speak to media but appeared relaxed, smiling and waving to voters as he passed.

Many supporters cited Hun Sen's oft-repeated mantra of stability as they backed his Cambodian People's Party.

‘I voted for his party because he has done many good things for the country,’ 68-year-old Rath Chy told AFP. ‘I need peace, stability and development.’

The last time Cambodians went to the polls -- national elections in 2013 -- the CNRP made huge gains, spurred in part by a significant appetite for change among young voters.

The opposition says it only lost that vote because of widespread fraud, something the government denies.

- Rare rally appearance - But analysts say that result was a scare for a leader unused to losing and the recent crackdown on the opposition is an attempt to ensure no repeat.

The CNRP's former leader Sam Rainsy currently lives in self-exile in France to avoid charges he says are politically motivated.

His replacement Kem Sokha spent nearly nine months barricaded in his party headquarters last year to escape a prosecution before he was eventually pardoned.

Casting his vote at a primary school in the capital, Kem Sokha told reporters he expected his party to win some 60 percent of the communes.

‘More and more people showed their willingness to support the CNRP,’ he said.

In a possible sign of nerves Hun Sen broke with his tradition of avoiding the campaign trail to lead a major CPP rally on Friday in Phnom Penh.

He has also given a series of increasingly shrill speeches in recent weeks, warning of war if he or his party loses power.

The CNRP also held a rally on Friday but it was noticeably smaller in size.

The party has proven particularly popular among young voters, who often complain about a culture of corruption that only seems to benefit a wealthy elite or those with the right connections.

Cambodia has one of the world's youngest populations, with some 70 percent of the country under 30, and they are courted by politicians.

Yet the opposition movement has been dented by Hun Sen's crackdown, with at least 27 Cambodian human rights defenders and political activists thrown behind bars since 2013, according to a recent Amnesty International report.

The National Election Committee said it expects to publish preliminary results late Sunday.