This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

Authorities on Wednesday identified a man who they said opened fire on sheriff’s detective — who was in the area for an unrelated investigation — and was then fatally shot in a standoff with SWAT deputies.

The detective, a 17-year veteran in his 30s, remained hospitalized in stable condition after being struck by gunfire. His injuries were described as not life-threatening.

Kerry Wesson, 45, exited his apartment in the 12200 block of Santa Fe Avenue in Lynwood about 1 p.m. Tuesday and opened fire on two detectives, according to a statement from the Los Angeles County Sheriff’s Department.

The investigators had gone to the location to follow up on a criminal case and were walking away when Wesson allegedly came out of his home and shot at them with a handgun.

One of the detectives was wounded but was able to return fire at Wesson, the statement said.

Several more gunshots were heard after the suspect returned to his home and barricaded himself inside, authorities said.

A standoff ensued and lasted more than two hours, during which time Wesson fired his weapon several times, the department said.

He was shot and killed by SWAT deputies when he quickly exited the residence while holding a semiautomatic pistol, according to authorities. It was unclear if Wesson fired the gun after coming out of the apartment; the weapon was recovered at the scene.

No deputies were injured.

It was later determined that there was no connection between the suspect and the investigation that brought the detectives to the location.

KTLA’s Kareen Wynter contributed to this report.