BROOKLYN — Police are investigating a video that shows NYPD officers punching a man while arresting him for trespassing inside a Target store in Flatbush, filmed as a group of angry onlookers shouted at them to stop, according to police and law enforcement sources.

The 14-minute recording begins by showing a group officers on top of the man, pinning him with their knees and bodies about 7:40 p.m. inside the store at 1598 Flatbush Ave.

One of the officers is shown slamming his knee into the suspect's head before he and a female officer begin punching him, according to the video uploaded to YouTube.

More police are then seen arriving at the scene, with multiple officers circling around the suspect to keep the increasingly agitated crowd from intervening.

Shouts of "You can't hit him!" and "Don't hit him!" can be heard in the recording, which was posted on Sunday.

"One person — 50 police for one person," another says, according to the video.

The man had exhibited "concerning behavior," so Target staff summoned police, according to a Target spokeswoman. She referred additional questions to the NYPD, which is currently investigating the incident.

Police eventually escorted the suspect through the crowd, with his shorts unfastened and resting at his ankles, the video shows.

The person shooting the video followed police outside, where the suspect was taken to an ambulance and then a squad car, the video shows.

"I'm out!" the suspect appears to shout as officers put him into the car.

The suspect refused to give his identification to arresting officers, according to the NYPD.

He faces charges of trespassing, resisting arrest, disorderly conduct and obstructing governmental administration, police said.

"At Target, we take the safety and security of our guests, team members and property very seriously," added Target spokeswoman Molly Snyder.

The person who uploaded the video did not immediately return a request for comment.