CHARLESTON, S.C. (AP) — A man has pleaded guilty to lesser charges in the stabbing death of a South Carolina teen more than two years ago.

Local media outlets reported that 19-year-old Matthew Fischer pleaded guilty to voluntary manslaughter Tuesday in court in Charleston.

Prosecutors say 17-year-old Lucas Cavanaugh was stabbed to death in Mount Pleasant in 2015 in a dispute over a girlfriend. Fischer had said he was defending himself.

Circuit Judge Markley Dennis is expected to sentence Fischer later this month.

Fischer had been charged with murder, which carries a penalty between 30 years and life in prison. The manslaughter plea carries a sentence of between two and 30 years.

Prosecutors have pointed to text messages before the fatal confrontation in which Fischer told Cavanaugh that he would kill him.