After a five-hour standoff, San Diego police arrested a gunman who allegedly engaged in a shootout with police from an apartment building on Wednesday.

According to The San Diego Union-Tribune, the suspect was identified as 33-year-old Titus Colbert.

Police say the incident began after they responded to a domestic violence call at approximately 9:15 a.m. in the Bankers Hill neighborhood. Once they arrived on the scene, Colbert began firing a high-powered rifle at police through a closed interior door of the apartment, prompting police to exchange fire as they retreated, reported NBC San Diego.

According to Lt. Scott Wahl, the shots came "within inches" of striking the officers as they approached the shooter's rooftop apartment. Fortunately, no one was hurt.

Because the apartment complex is located under the San Diego International Airport's approach path, airport officials halted landings as a precaution. Ground traffic in the community was also shut down. Meanwhile, residents in the area were asked to stay inside of their homes and away from windows in the complex.

During the standoff, negotiators tried to persuade Colbert to surrender as he randomly opened fire from the residence into the neighborhood, police said. At one point, the gunman threw a firearm out of the residence onto a patio. He also dropped a magazine and an AK-47-like rifle out a window right before he finally surrendered at 2:40 p.m. that afternoon. He was then taken into custody and charged with several counts, including attempted murder on a police officer and possession of an assault rifle.

A resident at the complex named Josh Hauptman said that he heard the gun fire and ran into the SWAT team as the incident unfolded.

"I don't live in a bad neighborhood. I don't live in a bad building," said the 30-year-old law student. "So I was really surprised that this kind of event was happening. It didn't fit the scene."