BUFFALO, N.Y. (WIVB) – Police in Buffalo, New York, have released footage of a security guard at a substance abuse treatment facility restraining a man who fired an AR-15 inside the clinic on Thursday.

A police spokesperson said officials believe the incident was an attempted robbery tied to drug activity that was connected to a separate shooting earlier the same day.

No one was injured by the shots fired inside the Alba de Vida facility, police said.

Footage from the facility’s surveillance camera shows the suspect — identified as Jeffrey Griffin — firing a round into the wall after entering the check-in area. A security guard standing near the entrance initially jumps back in shock before lunging at the shooter, who fires additional shots while grappling with the guard.

The guard eventually manages to get his arm around the shooter’s neck and his hand on the barrel of the rifle.

“Of course, the security guard had an initial reaction, and then he ran directly — very close proximity — ran directly at the individual,” Police Commissioner Joseph Gramaglia said. “[He] was able to grab a hold of him and the gun, and he held onto the barrel of the gun until help arrived — another security guard. Both of those security guards forced him out onto the sidewalk and held him on the ground until police arrived and were able to take him into custody.”

Gramaglia added that the gun carried by the suspect was an AR-15-style rifle, and the magazine was larger than allowed by law.

This incident, too, followed a separate shooting involving the same suspect at a home about a mile away earlier Thursday morning, according to police. In the earlier incident, a woman was shot in the leg during an apparent robbery.

Griffin, 48, was arraigned on Friday in connection with shootings at both locations, and faces charges of attempted murder and possession of a loaded firearm in connection to the earlier incident, and reckless endangerment, possession of an assault rifle and possession of an extended magazine for the second incident.

While no one was injured in the second incident, Erie County District Attorney John Flynn said things could have taken an “ugly” turn if not for the security guards on-site.

“This could’ve gotten ugly really quick,” Flynn said. “Due to the quick action — quite frankly heroic in my opinion — by the two security officers, no one got hurt there.”