Security cameras at a motel in Niagara Falls, Ont. captured the moment a man was shot in graphic surveillance video obtained by CTV News.

The grainy video shows a woman arriving at a room on the second floor of the Howard Johnson Express Inn located on Lundy’s Lane in the early hours of Sunday morning. Soon after, a man arrives and enters the same room as well.

A couple of minutes later, another man wearing a hooded sweatshirt who appears to be holding a gun shows up at the motel room. Witnesses said they heard a loud gunshot in the moments after he entered the room.

The footage then shows a man in a white sweatshirt run out of the room before he turns around and knocks on the door beside the room in question. Two men emerge from that second room and try to hold the door shut of the first room, according to the video. That’s when another gunshot was heard by witnesses and one of the men holding the door is seen dropping to the floor, apparently shot in the arm or hand.

The video then shows the man in the hooded sweatshirt exit the room. Before he can leave, however, a Niagara Regional Police Officer is seen in the video crouching behind a car in the parking lot with his weapon pointed at the suspect on the second floor.

Three people are then seen immediately surrendering with their arms up as they walk down the stairs to the parking lot, according to the security video.

Motel staff told CTV Toronto on Sunday that four men from New York State were staying in two rooms on the second floor of the building.

The police officer who responded was helping with a medical call on the other side of the motel when the shots rang out, which is why he was able to be at the scene so quickly, police told CTV Toronto.

Three suspects have been arrested and are in custody, police said.

With a report from CTV Toronto’s John Musselman