YAKIMA, Wash. — A 15-year-old boy who pleaded guilty in the shooting death of a 22-year-old man in Yakima will remain in juvenile custody until he’s 21.

Jose Alejandro Diaz pleaded guilty last week in Yakima County Juvenile Court to second-degree murder in the Aug. 8 death of Anthony Yocom.

Authorities had initially considered charging Diaz as an adult. Keeping the case in juvenile court was part of a plea agreement, Deputy Prosecutor David Soukup said.

“Both parties had a risk in this case,” he said.

“There were certainly some real issues about self-defense and whether self-defense was involved.”

Soukup said his office was satisfied with the outcome, adding that Diaz will benefit from the rehabilitation services provided by the juvenile system.

“We feel like it was a pretty significant offense and hopefully he will get some services in a structured environment like that,” Soukup said. “I think he and the community both might benefit from that. I definitely think he’s someone who needs services — he definitely has issues.”

Diaz was accused of shooting Yocom in the chest near his home in the 700 block of West Mead Avenue. Yocom died in surgery at a local hospital.

Police said witnesses told them that Yocom ran out of his yard to confront Diaz, who was walking with his girlfriend when the shooting occurred.

Diaz lives in the same neighborhood, but the reason for the encounter remains unclear, police said.

Diaz told authorities he shot Yocom in self-defense.

Relatives said Diaz was known to carry a handgun. At the time of the shooting, Diaz was wanted on a warrant for failing to appear in court for a drug paraphernalia charge last year.

He was expelled from Stanton Academy alternative school after being accused of possessing a marijuana pipe while on school grounds.

Yocom grew up in Yakima and graduated in 2009 from Davis High School, where he competed in football and wrestling, according to his obituary.