A Philippine mayor President Rodrigo Duterte named as being involved in the illegal drug trade was shot dead in jail on Saturday, police said, the second local official implicated in narcotics to be killed in two weeks.

Duterte, 71, won May elections in a landslide on a promise to kill tens of thousands of criminals to prevent the Philippines from becoming a narco-state, and has launched an unprecedented war on drugs that has left more than 4,000 people dead.

He had named several local officials, policemen and judges as being involved in the narcotics trade and urged them to surrender.

In August, he accused Rolando Espinosa, the mayor of Albuera town in the central island of Leyte, and his son of drug trafficking and demanded they turn themselves in, giving police a "shoot on sight" order if the two resisted arrest.

Mayor Espinosa then surrendered to the national police chief, saying he feared for his life, and was arrested last month.

But early Saturday morning, police said Espinosa was killed in his cell in the provincial jail after he shot at officers during a search for illegal firearms.

"He fired on the raiding team. The raiding team fired back and this led to the mayor's death," chief inspector Leo Laraga of the regional police told AFP.

He added that another inmate accused of drug trafficking was also killed, after he too fired at the officers.

The national police said it was investigating the circumstances surrounding Espinosa's death as well as possible collusion between guards and inmates to get guns and drugs into the jail.

Police chief Ronald dela Rosa previously said Espinosa had been listed in official records as a "drug protector", whose son Kerwin controlled the narcotics trade in the Albuera region.

Kerwin was arrested in the United Arab Emirates last month and is set to return to the Philippines to face drug trafficking charges.

In August, six of the Espinosas' supporters died in a gunfight with police outside the mayor's property in Albuera where officers said they recovered guns and several grenades.

Another mayor accused of drug trafficking was killed in the southern Philippines in late October.

Police said Samsudin Dimaukom and his security personnel opened fire after anti-narcotics police stopped their vehicles at a checkpoint on suspicion they were transporting illegal drugs.