Police deployed a battering ram and tear gas during a tense six-hour standoff between a suspect and a S.W.A.T. team in Long Beach, Calif. Thursday. But in the end, it was a police dog that brought the man down.

Anthony Glen Gorospe, a 51-year-old Long Beach resident, is in custody Friday after shooting a city official in the head and barricading himself against police for hours. After he's cleared from the hospital for his dog bite wounds, Gorospe will be booked on charges of attempted murder and possible weapons violations at Long Beach City jail.

The trouble started a little before 8 a.m. that morning, when city inspectors, accompanied by local police, attempted to examine the suspect's eyesore of a home. While the Long Beach PD don't have an official record of the number of times Gorospe's home has been inspected for blight, police accompanied city inspectors because there has been "a history" of problems at that address, said spokesperson Lisa Massacani.

But while the inspectors and police stood outside Gorospe's home, figuring out how to approach it through the piles of junk that crowed the front lawn, a shot rang out from inside the residence and struck one inspector in the head. As the suspect continued to fire his gun, Long Beach police called for backup from their S.W.A.T. team, who arrived on the scene within minutes.

Authorities immediately began securing the neighborhood. Nearby homes were completely evacuated and police used the reverse 9-1-1 system to warn other residents to shut their doors, lock their windows and remain indoors.

In order for S.W.A.T. to access Gorospe's home, they first had to tow the rusted cars that were parked in front of it, reports CBS2/KCAL9. During the standoff, the S.W.A.T. team used a ballistic tactical vehicle to smash into Gorospe's home, after which they deployed tear gas canisters. Throughout, police claim, Gorospe kept trying to commit suicide by cop -- repeatedly yelling for officers to shoot him.

At around 2:43 p.m., Gorospe finally came out from his home, and he was taken down by the police dog. Authorities found a rifle on the premises.

In this video shot by CBS2/KCAL9, an overhead camera captures Gorospe's modest home, which is darkened by several oversized trees. His belongings crowd the front yard and threaten to overtake the sidewalk.

Neighbors told CBS2/KCAL9 that Gorospe had lost his mother, step-father and sister in the last four years. A resident identified only as John claims that the hoarding started soon after the death of Gorospe's mother. "He collected that stuff to replace his mom," said John.

"I think he just snapped," offered another neighbor.

WATCH:

Resident Jill Lofton, who had known the suspect for 17 years, told the Los Angeles Times that she disagreed with the city's use of force, and that her neighbor was a good person.

"He looked like a homeless guy, but he really wasn't," Lofton said to the Times. "If you got past that and you had started talking to him, you'd find out he was genuinely a nice guy."

The city inspector who was shot in the head is expected to make a full recovery.

Massacani told HuffPost that the dog, a Belgian Malinois, is doing just fine after yesterday's operation. While it participates in training activities on a regular basis, said Massacani, it's likely that Thursday was the police pooch's first real face-off with a suspect.

Loading Slideshow...
  • A gunman is taken into custody by police after a standoff following a shooting at a Long Beach, Calif., house on Thursday July 5, 2012. Authorities report a police dog grabbed the subject allowing SWAT officers to handcuff the individual. The shooting victim is expected to survive. (AP Photo/Nick Ut)

  • SWAT officers move in to take a gunman into custody after a standoff following a shooting at a house in Long Beach, Calif., Thursday July 5, 2012. Authorities report a police dog grabbed the subject allowing SWAT officers to handcuff the individual. The shooting victim is expected to survive. (AP Photo/Nick Ut)

  • A screenshot of the home from Google Maps. The car parked in front of the home appears to be rusted and out of use, and a car parked in the home's driveway has trash strewn across the hood.

  • A screenshot of the home from Google Maps. Clutter and bits of debris crowd the home's front steps. Google Maps shows that the homes down the street are clean and well-lit with manicured lawns.

  • A car parked in the driveway of the home. Its hood is littered with trash.