Shocking video captures the moment a Homeless Services cop in New York City gets slugged and knocked out by a resident at a troubled Harlem shelter.

The footage — taken inside the Parkview Inn on West 110th Street last week and obtained by The New York Post — shows the officer first confronting the irate man in the hallway.

The officer is then seen trying to calm down the suspect. But the man grabs the officer’s mask and pulls it off his mouth and begins hurling punches, according to the video.

The cop, who sources said is a peace officer assigned to the city Department of Homeless Services, takes several steps before collapsing in the narrow hallway.

Another officer then yells at the attacker to stay down while holding a can of pepper spray as the man retreats into his room, footage shows.

NJ BOY, 3, MAULED TO DEATH BY PIT BULLS IS IDENTIFIED; NEIGHBORS HAD REPORTEDLY EXPRESSED CONCERNS OVER DOGS

The suspect can be seen going back into the hallway clutching some clothing.

He fled and is still on the loose, sources said.

The officer suffered a broken jaw, which has since been wired shut and will force him to eat and drink through a straw for the next six weeks, sources said.

The injured cop declined to comment on the case Sunday.

WARNING: GRAPHIC LANGUAGE IN VIDEO BELOW

The NYPD confirmed the attack to The Post on Sunday, adding in an e-mailed statement, "There are no arrests, and the investigation is ongoing."

The incident irked at least one law-enforcement source, who questioned whether the NYPD was doing enough to track down the attacker.

"The urgency to do something is not there," the source said.

"That could have been anyone," he said of the injured police officer. "It could have been another client or staff member, and had it been someone else, the urgency would have been way more. But because it’s a [DHS peace officer], the ones whose job it is to keep the peace in the shelter, we’re just passed aside."

The assailant had gotten into a dispute with a worker at the facility before the attack on the cop early Friday, according to sources and police.

CLICK HERE TO GET THE FOX NEWS APP

The troubled Harlem facility already has a checkered past — The Post revealed in a 2019 exclusive report that it was so poorly overseen that it had its own in-house heroin dealer.

"I do not feel safe here. At all," a 66-year-old Parkview resident said at the time. "It’s horrible. That’s why people prefer to live on the streets."

To read more from The New York Post, click here.