MANILA — Denouncing what he called efforts to paint him as a “heartless violator of human rights,” President Rodrigo Duterte said on Wednesday that the Philippines was withdrawing from the treaty that established the International Criminal Court.

The Hague-based court said last month that it was opening a preliminary inquiry into allegations that Philippine officials committed mass murder and crimes against humanity in the course of Mr. Duterte’s crackdown on narcotics. Thousands of people have died at the hands of police officers or unknown gunmen since Mr. Duterte took office in 2016 promising to kill drug dealers and addicts.

In a written statement released on Wednesday, Mr. Duterte accused the court of violating “due process and the presumption of innocence.”

“The acts allegedly committed by me are neither genocide nor war crimes,” he said. “Neither is it a crime of aggression or a crime against humanity. The deaths occurring in the process of legitimate police operation lacked the intent to kill.” He said the killings by police officers, which the police say now number more than 4,000, were carried out in self-defense.