A veteran NYPD officer got a horrifying surprise when he sat down to a steak-sandwich dinner — chomping down on a razor blade hidden inside the meal, according to police.

The 56-year-old cop suffered a cut inside his mouth as he bit into the dangerous deli sandwich from Bon Appetit Speciality Food Store in the Rockaways at around 4:30 p.m. Thursday.

Police sources said the 24-year veteran, assigned to the Critical Response Command in the Counterterrorism Bureau, dug into the meal at a nearby NYPD facility.

“Thank God he didn’t swallow that blade,” a source said. “He could have sustained serious life-threatening injuries if he did.”

The officer was taken to Nassau University Medical Center for treatment.

The NYPD is investigating how the blade ended up in the meal and whether the officer was targeted. He was in plainclothes when he placed his order but rolled up to the deli in a marked police car.

“He was clearly identifiable as a cop,” a source noted.

Police Commissioner Dermot Shea tweeted a photo of the razor blade and sandwich along with a scathing message.

“To repeat: The NYPD has ZERO tolerance for acts of violence against our police officers,” he wrote. “A sandwich bought at a Queens deli on Thurs. contained a razor blade that cut the inside of a @NYPDCT cop’s mouth. He’ll be OK, but a full investigation into this abhorrent act is underway.”

The officer could not be reached for comment.

Three police officers reviewed internal surveillance footage at the deli on Friday and left around noontime. DNA evidence had also been collected from the blade, sources said.

Management for the neighborhood eatery apologized in a lengthy statement.

“In our experience, the NYPD officers of the 100th and 101st precincts have been an exemplary example of professionalism and service to not only our business but to our local community in the Rockaways, Queens and New York City at large,” the statement read. “If given the opportunity, the management of Bon Appetit would like to personally apologize to the officer and the rest of the local law enforcement community.”

Mary Marnick, born and raised in the Rockaways, said she has frequented the deli for 20 years.

“This is shocking to me. I’ve never had a problem before,” she said after buying some turkey.

The New York State Department of Agriculture and Markets, which regulates the deli, promised an investigation.

Additional reporting by Alex Taylor and Lia Eustachewich