A gay high school student who was found guilty of stabbing a classmate to death in a New York City high school was sentenced to 14 years in prison Tuesday.

Abel Cedeno fatally stabbed Matthew McCree, 15, in a history class at the since-closed Urban Assembly School for Wildlife Conservation and seriously injured another student, Ariane Laboy, 16, during a Sept. 27, 2017 fight at their Bronx school.

Cedeno, 20, came out as gay after his arrest. He has said he was bullied for years by his peers over his perceived sexuality and had acted in self-defense.

Cedeno was on trial for manslaughter, assault and criminal possession of a weapon and was found guilty of all charges in July. He faced 50 years in prison.

The judge declined to impose youthful offender status on Cedeno and sentenced him on Tuesday to 14 years in state prison for the manslaughter conviction and eight years for the assault. The sentences will run concurrently for all three charges.

Authorities said Cedeno stabbed McCree and Laboy with a switchblade as about 15 to 20 other students watched.

Bronx District Attorney Darcel Clark said in a statement Tuesday, that there was no evidence McCree or Laboy ever bullied Cedeno.

"His explosion of rage has left so many lives in ruins, including his own," Clark said. "Now he will spend many years in prison. We, as a society, must do everything to prevent violence in our schools.”

Cedeno expressed remorse and regret as he addressed the judge and victim’s family members in court.

McCree's family was at the courthouse Tuesday for Cedeno's sentencing.

Cedeno's family gathered in a hallway where they prayed before a judge handed down his sentence.

McCree's death was the first homicide in a New York City school since 1993. It prompted protests from parents who said the school should have had metal detectors. LGBTQ advocates also called for the city to address the bullying of gay students.

Outside of the courthouse Tuesday, McCree's mother, Louna Dennis, told reporters she was "very pleased" with the verdict.

"I didn't get my 50 years, but I'll take the 14," Dennis said. "I'm pleased with the judge."

Attorney Sanford Rubenstein, who is representing Dennis in a civil case against the New York City Department of Education, said the agency was as liable as Cedeno for the wrongful death of McCree and assault of Laboy.

“Today, Abel Cedeno was held accountable for the wrongful death of Matthew McCree and the stabbing of Ariane Laboy," Rubenstein said, adding that it was now time for the agency to be held liable for its responsibility.

Rubenstein said the school where the killing and assault took place should have been equipped with metal detectors and that there was a failure to maintain supervision in the classroom and to follow the state's Dignity for All Students Act, which prohibits bullying and harassment.

Rubenstein also said he hoped the sentence served as an example to other students.

“If you bring a knife to school, if you use that knife to kill another, you will be held accountable and you will go to jail for a long time," Rubenstein said.