MANILA — The Philippines’ war on drugs has killed thousands, drawn global condemnation and enmeshed the police force in scandal. Yet President Rodrigo Duterte’s bloody campaign is overwhelmingly popular here.

The reasons are manifold, but they hinge on Filipinos’ apparent willingness to overlook the death toll as long as Duterte’s government satisfies their individual economic and political interests, analysts say. The politician promised to eradicate criminals — “kill them all,” he said — and Filipinos appear to view Duterte as keeping his word.

The country’s police chief resigned this month over accusations that he allowed 13 officers to resell confiscated drugs and release a crucial suspect. The chief, Oscar Albayalde, denied the allegations, which date from his time as a provincial commander in 2013. Investigators called for graft and drugs charges against him.

The controversy is a blow to the credibility of the police, inviting renewed scrutiny of the drug war. But experts said it is unlikely to derail Duterte’s signature policy.

“The war on drugs has been synonymous with the president. They mutually feed each other,” said Francisco Ashley Acedillo, a former lawmaker. “Until one is undone, the other will not be undone.”

In September, the government cited an 82 percent satisfaction rating for the drug war in a Social Weather Stations survey as it pushed back on a U.N. resolution calling for the investigation of human rights violations. Police records show over 6,000 deaths in anti-drug operations, but human rights watchdogs count more than 20,000 others killed by unknown perpetrators.

Polling released last month put Duterte’s satisfaction rating at 78 percent, slightly below previous results. The president enjoyed a higher rating of “very good to excellent” among wealthier Filipinos, but his popularity among the poorest respondents has decreased.

On the campaign trail, Duterte diagnosed drugs as the scourge of society, claiming their use was connected with rape and murder. The narrative struck a chord with his supporters, propelling him to victory in 2016 elections. (Officials in 2015 estimated there were 1.8 million drug users in the Philippines.)

Duterte was the only candidate who offered a solution to the prevalence of drugs, a longtime frustration among the urban poor, said Jennifer Oreta, an assistant professor of political science at Ateneo de Manila University.

But the crackdown targets the poorest citizens while satisfying the middle class and overseas Filipinos who are pivotal in determining election outcomes, Oreta said.

For Maria, who lost a brother and father to the drug war in 2016, the shake-up among senior police is “just right.” She asked to be identified by only her first name for safety reasons.

Plainclothes police killed her father when they stormed her house past midnight in a slum north of Manila, she said. He was listed as one of the deaths in police operations. As she readied his funeral arrangements the next day, her brother’s body was wheeled in, covered in packaging tape.

“Some people are scared to talk because [Duterte] is still sitting in power. But when he’s gone, they’ll come out,” Maria said.

So far, Duterte has emerged relatively unscathed even when he has taken positions at odds with public sentiment, notably his turn away from the United States and pivot toward China.

Polls show that Filipinos distrust Beijing — which asserts sovereignty over waters claimed by the Philippines — but perhaps not enough to bother rural communities that stand to benefit from Chinese infrastructure loans. When Duterte appeared to side with Beijing after a Chinese trawler sank a Philippine fishing boat, his popularity was largely unaffected.

While cozying up to China, Duterte has raised salaries for the armed forces, effectively buying the acquiescence of a group that had expressed concerns about Beijing’s expansion in the South China Sea, senior military officials have said.

Several scandals have rocked the police force during his term. In 2016, authorities revealed that a kidnapped South Korean national was killed in police headquarters, and his ashes flushed down a toilet. The killing of 17-year-old Kian Delos Santos the following year led to the only conviction of police officers in a drug-war-related killing.

However, the head of the police then, Ronald dela Rosa, went on to win a seat in the Senate, having won over voters by participating in game shows and using a mascot to poke fun at himself.

Acedillo, the former congressman, said the Philippines’ institutions are often personality-driven, helping to explain the appeal of strongman-style leaders.

But not all Filipinos support the way Duterte has prosecuted the drug war.

Amnesty International cites previous surveys showing that Filipinos fear for their families’ lives and prefer due process over summary executions.

“While surveys would show that many Filipinos appear to support the anti-drug campaign as a way to tackle crime, they also show the public have serious, growing concerns,” said Nicholas Bequelin, Amnesty’s director for East and Southeast Asia and the Pacific. “After scandal upon scandal, the mood seems to be shifting.”

Phil Robertson, deputy director of Human Rights Watch’s Asia division, calls Duterte’s continued popularity “a mystery” and all the more reason for international institutions to step in to stem the carnage.

The International Criminal Court is probing killings in the Philippines, prompting Duterte to retaliate by withdrawing the country’s membership.

But in the absence of more-forceful external intervention, experts say, the drug war’s toll shows no sign of easing.

“The operation has taken a life of its own,” said Oreta, the political scientist. “It won’t stop just because there’s controversy on top.”