Rodrigo Duterte has told Philippines police they are allowed to kill “idiots” who violently resist arrest, two days after hundreds of people turned the funeral of a dead teenager into a protest against the president’s deadly war on drugs.

Duterte broke off midway through a prepared speech at the Heroes’ Cemetery on the outskirts of Manila on Monday and addressed impromptu comments to Jovie Espenido, the police chief of a town in the south where the mayor was killed in an anti-drugs raid.

“Your duty requires you to overcome the resistance of the person you are arresting ... [if] he resists, and it is a violent one ... you are free to kill the idiots, that is my order to you,” Duterte told the police officer.

Duterte added that “murder and homicide and unlawful killings” were not allowed and that police had to uphold the rule of law while carrying out their duties.

Duterte unleashed the anti-drugs war after taking office in June last year following an election campaign in which he vowed to use deadly force to wipe out crime and drugs.

Thousands of people have been killed and the violence has been criticised by much of the international community.

Domestic opposition has been largely muted but the killing of schoolboy Kian Loyd delos Santos by anti-drugs officers on 16 August has sparked rare public outrage.

More than 1,000 people, including nuns, priests and hundreds of children, joined a funeral procession on Saturday for the 17-year old, turning the march into one of the biggest protests yet against Duterte’s campaign.

Delos Santos was dragged by plain-clothes policemen to a dark, trash-filled alley in northern Manila before he was shot in the head and left next to a pigsty, according to witnesses whose accounts appeared to be backed up by CCTV footage.

Police say they acted in self defence after the teenager opened fire on them, and Duterte’s spokesman and the justice minister have described the killing of the teenager as an “isolated” case.