The NYPD said it was not prepared for the massive uptick in fatal opioid overdoses in the city last year, which killed approximately 1,300 people — more than homicides and traffic collisions combined.

“We were at a level of 700 to 800 [fatal] overdoses a year and the needle had not been moving on this,” said Dermot Shea, the department’s chief of crime control strategies, speaking at a Police Executive Research Forum Thursday at NYPD headquarters.

Shea said the number of fatal overdoses has been climbing over the last few years before hitting the previous year’s total of 937 deaths in 2015.

But in 2016 the number of deaths exploded to department’s projected total of 1,300 — mainly as a result of heroin and painkiller overdoses.

By comparison, 335 people died from homicides citywide in 2016, while the number of traffic fatalities was 220.

“We were not ready for that uptick when we saw a 38 percent increase in 2016,” Shea said.

“Did it creep up on us? Somewhat.”

“We were a disaster internally, the NYPD, on measuring data regarding [overdoses],” he said.

“We were busy and we were doing other things,” he added. “The focus wasn’t always on this. The focus is on this now.”

To combat the opioid epidemic gripping the city, the NYPD has taken the same principles it uses to fight crime with precision and applied them to preventing overdoses.

The NYPD and the city’s Department of Health the past few years have been jointly tracking overdose deaths through a program called Rx Stat — similar to CompStat, which allows city officials to track crime patterns and see where enforcement is needed.

“(It is) a comprehensive surveillance system to monitor in real time opioid and other drugs and associated consequences,” said Dr. Denise Peyone, a Heath Department official and Rx Stat member.

“When I say real time, I mean real time.”

Peyone said Rx Stat meets monthly and allows police and health officials to detect outbreaks or localized overdoses.

Police Commissioner James O’Neill said the opioid issue is not just a city issue, calling it “a national crisis.”

“This problem is changing the way the men and women of this department have to do their jobs,” he said, adding that around 17,000 of his cops are trained to use naloxone — a nasal spray that reverses the effects of a drug overdose.

Cops saved around 150 overdose victims last year with the medication and O’Neill said the NYPD intends to spend $190 million distributing naloxone kits to officers.

The NYPD also saw a 57 percent increase in heroin sale arrests between 2011 and 2015 and a 32 percent increase in heroin seizures between 2014 and 2015.

“We cant arrest our way out of this problem,” O’Neill said.

“When our investigators interview someone lucky enough not to die from an overdose, we tell them we’re not going to lock them up. We want to know and where they got their drugs. We want to move further up the food chain until we cut off the supply.”