A man suspected of shooting and injuring an L.A. County sheriff's deputy has been shot and killed, the L.A. sheriff's department confirmed Saturday.

After a search that stretched for several hours, a SWAT officers discovered the suspected gunman in a dumpster near the incident, on the 2700 block of Grand Avenue, deputy Lillian Peck told KPCC. The suspect then threatened the officer with a gun, and was shot and killed.

Paramedics tried to treat the injured man, but "ultimately the suspect was pronounced dead at the scene," Peck said.

The officer who was injured in the initial shooting at 4:00 a.m. has since been treated and released from a nearby hospital, Peck said. He has been with the department since 2010.

It's not yet clear why the deputy had attempted to stop the suspect. Peck said detectives still need to interview the injured deputy on what happened.

An LASD commander tweeted Saturday afternoon that some roads near the two incidents are still taped off so detectives can continue their investigation.

9:27 a.m. Saturday: Deputy injured in Walnut Park shooting

L.A. sheriff's homicide detectives are searching for a suspect after an early morning shooting left a deputy injured, sheriff's officials said.

The incident took place at Pacific Boulevard and Grand Avenue in Walnut Park shortly after 4 a.m. Saturday morning. Deputy Kelvin Moody told KPCC the surrounding area has been taped off as deputies search for the suspect.

"All we know right now is that a deputy was shot and sustained a non-life threatening injury," he said.