LYNWOOD ( — A man suspected in the shooting of a Los Angeles County sheriff’s deputy was shot and killed Tuesday after a three-hour standoff.

The initial shooting was reported around 1:05 p.m. along the 12000 block of Santa Fe Avenue near El Segundo Boulevard, according to Los Angeles County Fire.

READ MORE: Flight From New York's JFK To John Wayne Airport Diverts To Denver After Flight Attendant Attacked By Passenger

The man, who has not been identified, opened fire on two detectives who were following up on an investigation. One detective based out of sheriff’s Century station was shot in the shoulder.

KCAL9’s Cristy Fajardo spoke with Nicole Nishida of the Los Angeles County Sheriff’s Department about the the deputy’s condition.

“The detective is a male in his 30’s, he’s been on the department for about 17 years,” said Nishida. “He is in stable condition and is expected to survive.”

By midafternoon, dozens of deputies had surrounded an apartment building in the 12000 block of El Segundo Boulevard in Compton, where the man was believed to be hiding.

READ MORE: Clippers Lose to Cavaliers 92-79

A SWAT team was called in, and neighbors were evacuated, Payne said.

SKY9 showed at least three armored vehicles and numerous patrol cars at the scene. The SWAT team sent a battering ram to pull down the front gates from the apartment and break down the front door.

A robot was seen moving into the apartment to gain visual access for deputies.

About 4:20 p.m., the man ran out of the apartment he was hiding in, holding a weapon, and was shot by sheriff’s deputies.

“The suspect was pronounced deceased at the scene and the weapon was recovered,” Nishida said.

MORE NEWS: Beverly Hills Police Department Accused Of Racial Profiling

This remains an on-going investigation as deputies are trying to determine if the man fired as he left the apartment.