Tens of millions of Filipinos have voted in midterm polls that are being seen as a crucial referendum on Rodrigo Duterte’s brutal crackdown on illegal drugs, unorthodox style and contentious embrace of China.

The poll is expected to strengthen the controversial president’s grip on power, paving the way for him to deliver on pledges to restore the death penalty and rewrite the constitution.

Duterte has found international infamy for his foul-mouthed tirades, but remains hugely popular among Filipinos fed up with the country’s dysfunction and elite politicians.

Philippine President Rodrigo Duterte. Photograph: Mark R Cristino/EPA

More than 18,000 seats, including half of the seats in the Senate, are at stake. Polling stations opened at 6am local time and closed 12 hours later.

For Duterte, the key is wresting control of an independent-minded Senate while keeping the House of Representatives in the hands of his allies. All eyes are on the 12 Senate seats up for grabs, where government critics fear Duterte’s handpicked candidates will dominate.

“It could give Duterte the numbers to pass the death penalty, impeach and convict vice president Leni Robredo and concur in the ratification of a treaty that onerously favours China,” said Antonio La Viña, constitutional law professor in the University of the Philippines.

Duterte is a vocal advocate of the reimposition of death penalty in the predominantly Christian country. Activist and nun Sister Mary John Mananzan said bringing back the death penalty would be “reprehensible”.

“I hope they do not dominate Senate at all. If they do, then they are dominating everything already. What are we? We are no longer a democracy. We will go back to People Power,” said Mananzan, referring to the 1986 movement that toppled dictator Ferdinand Marcos.

Mananzan said the country, already reeling from thousands of people killed in Duterte’s brutal campaign against illegal drugs, could spiral into further violence.

“As we all know, death penalty doesn’t diminish the crime. Who are they going to kill? It’s the poor people who will be killed because they won’t have access to lawyers. It is really an all out war on the poor,” she said.

‘Last line of defence’

Opposition senators have also vowed to fight back, but acknowledged that the battle would be harder with Duterte’s allies packing the Senate.

Duterte’s most strident critic in the upper house, Senator Antonio Trillanes IV, is also stepping down after his term ends in June 2019.

“The Senate is the people’s last line of defence within the government against continuing attempts to undermine our democracy and attack our human rights. Whatever the outcome of the elections, we are used to difficult fights. We are prepared to fight the long game,” said Senator Risa Hontiveros.

Duterte wants to bring back capital punishment for drug-related crimes as part of a crackdown on drugs in which thousands of suspects and drug users have already been killed.

His tough-on-crime platform – which also includes lowering the age of criminal responsibility from 15 to 12 – was key to his landslide election victory in 2016.

Historically, the nation’s 24 senators – who serve six-year terms – have had a reputation for being more independent than the lower house.

Winning a Senate majority, something that independent national surveys indicate is well within reach, would give Duterte legislative backing for his anti-crime proposals and his plan to rewrite the constitution. The opposition warns that could lead to the single-term limit for the presidency being lifted, allowing him to seek re-election despite his repeated statements that he would stand down at the end of his mandate.

The Philippines outlawed capital punishment in 1987, reinstated it six years later and then abolished again in 2006.

Senator Grace Poe, among the frontrunners in the senatorial race, joined calls for an independent Senate.

“At a time when the Constitution and our institutions are attacked on all fronts, this Senate could be the last stronghold of democracy,” said Poe.

Philippine police and military prepare to be deployed for elections security. Photograph: Rolex dela Peña/EPA

The results for municipal and city mayors and councils were expected within hours of the polls closing. Winners for the Senate and congressional seats are scheduled to be declared from Friday.

Even if the presidential term limit is not lifted, the Duterte family looks well-placed to continue after him.

The president’s daughter Sara – tipped by many as the president’s successor in the 2022 presidential vote – is running to keep her post as mayor in its southern bailiwick of Davao city.

Her younger brother Sebastian is seeking, unopposed, the city’s vice-mayoral seat, while the eldest presidential son Paolo is standing for a seat in the House of Representatives.

Electoral contests in the Philippines have always been bloody, with dozens, including candidates and their supporters, getting killed in the fierce competition for posts that are a source of wealth in a nation with deep poverty.

Police are on full alert to safeguard Monday’s balloting as the bloody trend continued this year, with 14 dead and 14 wounded in “election-related violent incidents” since January, according to a grim official count.

Agence France-Presse contributed to this report