Published: Mar 20, 2013 12:38 PM EDT
Updated: Mar 20, 2013 1:19 PM EDT

MIAMI (AP) - An appeals court has tossed out the life prison sentence imposed on Michael Hernandez, convicted of killing his best friend in a Florida middle school restroom when both were 14.
The 3rd District Court of Appeal ruled Wednesday that Hernandez must get a new sentencing hearing because a judge imposed a mandatory life prison term in the case. While Hernandez's appeal was pending, the U.S. Supreme Court ruled last year that mandatory life sentences cannot be imposed on juveniles.
Hernandez was convicted in 2008 for the killing four years earlier of Jaime Gough at Southwood Middle School near Miami. Gough was stabbed 42 times. Hernandez confessed to the killing but then mounted an insanity defense that was rejected by jurors.
Testimony showed Hernandez had a hit list that included Gough.

(Copyright 2013 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.)