Philippine President Rodrigo Duterte told police on Monday they were free to kill 'idiots' who violently resist arrest, two days after the funeral of a boy who was gunned down and left next to a pigsty by anti-drugs officers.

Duterte was delivering a prepared speech at the Hero's Cemetery on the outskirts of Manila and veered off-script to address impromptu comments from Jovie Espenido - the police chief of a town in the south where the mayor was killed in a raid.

In a direct message to his police officers, he said: '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.'

It comes two days after Kian Delos Santos was laid to rest in a service that was hijacked by hundreds to protest against the leader's deadly war on drugs.

Philippine President Rodrigo Roa Duterte aiming a rifle while meeting government troops during a surprise visit in the conflict-torn city of Marawi, southern Philippines, August 24, 2017

Philippine President Rodrigo Duterte wears a bulletproof vest and helmet with government troops in Marawi CityPhilippine President Rodrigo Duterte visits troops, Marawi City, Philippines where he visited the government troops in Marawi City on Thursday

Australia's top overseas spy has met with controversial Philippines president Rodrigo Duterte and posed alongside him copying his signature fist-pump hand gesture

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.

The Philippines leader 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 Delos Santos by anti-drugs officers on August 16 has sparked rare public outrage.

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.

Filipino schoolboy Kian Delos Santos (pictured), 17, was shot dead by police last week. They claimed he was a drug courier who fired at them, but CCTV appears to show he was unarmed

The slow-moving procession snaked through narrow streets as participants, many wearing black ribbons, carried posters that read 'Stop Killing the Poor'

Santos' mother Lorenza is pictured weeping as she looks at the body of her slain son

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

Since Duterte's term began 14 months ago, police have reported killing 3,500 people in anti-drug operations, with thousands more murdered over drug-related crimes and in unexplained circumstances.

Duterte and his drug war are backed by a large majority of Filipinos fed up with high crime and a slow-moving judicial system, according to national polls.

But Delos Santos's murder has dominated the media and sparked public outrage.

After his family held a wake for him at home, around 3,000 people including his classmates, neighbours, nuns, priests and human rights activists marched under cloudy skies to protest his killing.

'Kian is the name and face of the truth. We must not allow the truth to die with Kian's murder,' said Father Robert Reyes, one of several Catholic priests who celebrated a church mass for the boy on Saturday.

Duterte, who had controversially drawn parallels between his drug campaign to Hitler's extermination of Jews and vowed to protect police from prosecution, has promised to bring the boy's killers to justice.

The slow-moving procession snaked through narrow streets as participants, many wearing black ribbons, carried posters that read 'Stop Killing the Poor', 'Justice for Kian', and 'Rehabilitation not Persecution'.

Thousands of people flocked to the teenager's funeral to protest President Rodrigo Duterte's brutal war on drugs (his flower-decked hearse is pictured)

A funeral worker shows media the body of Santos, whose murder has dominated the media and sparked public outrage

Around 3,000 people including Santos' classmates, neighbours, nuns, priests and human rights activists marched under cloudy skies to protest his killing

The cortege stopped briefly for prayers outside a police station where the three officers who had arrested the boy were deployed. They have since been suspended.

Following their claims of Delos Santos being involved in the drugs trade, police told a public enquiry on Thursday that they only read about his alleged narcotics activity on 'social media' after his death.

A police autopsy also concluded the boy was fatally shot in the head twice as he lay prone on the ground.

Amnesty International alleged in a report released in February that Philippine police shot dead defenceless people, fabricated evidence, paid assassins to murder drug addicts, and stole from those they killed or the victims' relatives.

It also said police were being paid by their superiors to kill drug suspects, and documented victims as young as eight years old.