YAKIMA, Wash. (AP) — A 21-year-old Yakima man has been sentenced to 20 years in state prison for an April 2020 stabbing death.

Andrew Douglas Olsen entered a plea to second-degree felony murder in Yakima County Superior Court on April 28 in the death of Francis Gallagher, the Yakima Herald reported.

In return for his plea, prosecutors dismissed charges of intentional second-degree murder, first-degree assault and an unrelated charge of failing to register as a sex offender.

Olsen was out on pretrial release on the sex-offender charge when he stabbed Gallagher in his apartment April 22, 2020. An autopsy determined he had been stabbed more than 20 times in the left arm, left shoulder and side of his face.

When detectives questioned Olsen they took a pocketknife from his bag and sampled a blood stain on his shoe, according to court documents. Olsen told police he attacked Gallagher because he said Gallagher wanted to have sex with him and had hit him in the head with a stick when he tried to leave.