An active shooter pinned down police with gunfire outside a San Diego, California apartment building for more than five hours before he was taken into custody. A SWAT team and crisis negotiators were on the scene.

The shooter barricaded himself in a bedroom in a sixth-floor apartment.

When police arrived at the building in response to a domestic violence call around 9:10 a.m. local time, the suspect fired rounds at police through a closed door when officers arrived, nearly hitting them. The officers returned fire, San Diego PD said.

A negotiations team was in contact with the gunman for several hours, Lieutenant Scott Wahl said during a briefing. He reiterated that people in the area were safe as long as they remained inside.

#breaking active shooter in bankers hill. PD shutting down streets. Officers: shooter has a long range rifle. #NBC7pic.twitter.com/t6M9qg9Wg2 — Greg Bledsoe (@bledsoenbc) November 4, 2015

Active shooter with high powered rifle on the roof of 2400 Brant st, officers pinned down by gunfire . SWAT https://t.co/DMh4IEVImX — Angie Baby (@AngieKoolAidKid) November 4, 2015

"He's been actively shooting, sporadically," Wahl said, adding that police didn’t believe the suspect had taken any hostages and that the woman involved in the domestic violence call was "safely with us."

"What we're hoping is that the suspect is going to surrender peacefully... we've got him safely contained, safely isolated," Wahl said.

Police closed Curlew, Brant, Albatross and Front Streets between Laurel Street and W. Ivy Street, which are between San Diego International Airport and the San Diego Zoo.

A “full ground stop” was issued at the airport, also known as Lindbergh, meaning no flights were allowed in or out. Later, the airport was allowing planes to leave, but not land.

Police asked residents near the Brant Street in the Bankers Hill neighborhood to remain inside, away from windows until further notice.

Swat situation in Bankers Hill across from our house. Woke up to what we thought was a gun shot this morning. @CBS8pic.twitter.com/JUaxmaT3I3 — Dominic Garcia (@DomCBS8) November 4, 2015

"We were trimming trees, and we were coming around the way, and we heard some gunshots," a landscaper who was working nearby told KGTV.The

The SWAT team arrived on the scene as a man was shooting at a police dog from the window of the apartment complex, KFMB reported.

JUST IN: Shots fired in Banker's Hill; suspect has rifle, SWAT standoff underway: https://t.co/h3xWPkxRNkpic.twitter.com/NBSnmlAsOt — 10News (@10News) November 4, 2015

Police described the gunman as a black man who is 32 years old; 5 feet, 11 inches; and about 290 pounds with black hair.

Washington Elementary School was placed on lockdown with access to the campus restricted, a school district spokeswoman told the San Diego Union-Tribune. As a precaution, City Tree Christian School was locked down as well. Both schools are near the active shooting scene.

PD using cars/homes as shields....shooter allegedly has long rifle. Complex on Brant and Kalmia @CBS8@News8pic.twitter.com/23v7qJu7A3 — Shannon Handy (@ShannonCBS8) November 4, 2015

Eyewitness Austin Kinghorn thought at first that he was hearing more thunder from a rain storm last night, he told the Union-Tribune’s Sandy Coronilla. He counted six or seven shots while he was inside the building, then “counted meticulously once I got out here. I was counting in my head, there were 48 shots fired.”

A man who lives next door to the suspect said that there is now a bullet hole in their shared wall, he told KSWB, adding that he hid in a bathtub.

Neighbor to #BankersHill SWAT standoff suspect says there's a giant bullet hole in his wall https://t.co/2K5YKPl7ZJpic.twitter.com/raD7OBggMq — Fox 5 San Diego (@fox5sandiego) November 4, 2015

By 1 p.m. local time, police gave the all-clear for air traffic to resume, despite the continued standoff because the shooter was isolated in a location where they believed he would not be able to shoot at any aircraft. The school lockdowns were also been lifted.

"At this point we have no information on injuries and hope it stays that way," Wahl said during a second update. When asked if the gunman has been cooperative, he replied: “I would not say cooperative until he surrenders.”

BREAKING: MULTIPLE gun fire rings out near Front & Laurel St; officers force all residents into homes @nbcsandiegopic.twitter.com/T3uJNEX1AO — Liz Bryant (@LizBryantTV) November 4, 2015

More swat team members going in apt building in Bankers Hill for stand off suspect. @CBS8pic.twitter.com/A3hjU1Zb4q — Dominic Garcia (@DomCBS8) November 4, 2015

As the standoff reached its fourth hour, police fired tear gas into the apartment, trying to flush the suspect out. He complained that his throat is burning, but was not coughing, according to police radio traffic.

On the scene of Bankers Hill active shooter situation, Laurel & Front, looking west. pic.twitter.com/UnKMAkvzVl — Sandy Coronilla (@SandyCoro) November 4, 2015

Just after 2:30 p.m., San Diego PD confirmed that the suspect was in custody, more than five hours after the standoff began.