MANILA (REUTERS) - The Philippine Supreme Court on Tuesday (April 3) ordered police to hand over full records of thousands of deadly encounters in the country's war on drugs, thwarting a government bid to keep operational details of the bloody crackdown secret.

The high court gave the solicitor-general, Mr Jose Calida, 15 days to comply with a December order that he had challenged on the grounds of national security.

Human rights and legal groups lauded the decision as a triumph that would help bring to book state officials involved in what they say are systematic abuses, cover-ups and executions during President Rodrigo Duterte's bloody 21-month campaign.

"The Supreme Court has demonstrated with this initial order that it will perform its role as our people's beacon and bastion of justice," said the Centre for International Law, a group of domestic human rights lawyers who were among the petitioners who had asked for the incident records to be disclosed.

Solicitor-general Calida did not immediately respond to a request for comment. Police spokesman John Bulalacao said he would not respond until he had received a copy of the court order.

The move comes just a few months after the International Criminal Court (ICC) announced it had started a preliminary examination of a complaint filed by a Philippine lawyer accusing Mr Duterte and top officials of crimes against humanity.

Mr Duterte has since withdrawn the Philippines' membership of the court in protest, even though it has no impact on the ICC's jurisdiction, which applies for the period in which a country was a member.

About 4,100 people have been killed by police and several thousand more by unknown gunmen whom the authorities have described as vigilantes, or rival gang members.

Police deny allegations they have murdered people involved in drugs and say those killed were all dealers who violently resisted arrest.

Supreme Court acting Chief Justice Antonio Carpio told Mr Calida to submit names, addresses and gender of those killed in police operations, and other drug-related deaths.

Mr Carpio demanded details of each deadly anti-drug operation, the police and witnesses involved and copies of warrants against suspects who were killed.

The order covers drug-related deaths from July 2016 until November 2017, when two complainants, including a group of Manila slum dwellers, petitioned the court to make the details publicly available.

Human rights lawyer Edre Olalia said the government must comply with the court order and follow the law.

"It's about time the government should take responsibility and, if so proven, liability for playing God in the snuffing of lives," he said.