Berrendo Middle School shooting victims Kendal Sanders (left) and Nathaniel Tavarez stand on the pitcher's mound with former Los Angeles Dodgers and Albuquerque Dukes manager Tommy Lasorda to throw out the ceremonial first pitches at Isotopes Park in Albuquerque. File picture: Roberto E Rosales, The Albuquerque Journal

Roswell, New Mexico -

A judge on Wednesday ordered the maximum sentence for a 12-year-old boy who opened fire in a New Mexico school gym earlier this year, injuring two students.

After a day-long hearing, District Judge Freddy Romero ordered the boy held in state custody until he is 21.

Prosecutors had sought the maximum punishment for the boy, who pleaded no contest to the January shooting in Roswell. His lawyers asked that he be placed in treatment for two years and then released if doctors determine he is no longer a threat.

A defence memo said the boy was chronically bullied, is socially and emotionally immature, and regrets what he did.

Roswell police said the boy took a modified shotgun to Berrendo Middle School in south-eastern New Mexico on January 14 and opened fire on students as they waited for classes to begin.

Nathaniel Tavarez, 12, and Kendal Sanders, 13, were injured in the shooting, which sent the school into a panic. Tavarez spent weeks in hospitals and rehabilitation centres for treatment of wounds to his chest, heart, face and head. His vision in both eyes has been severely diminished.

Sanders was later released from a hospital after surgeries to repair damage to her right arm and shoulder.

The boy was charged with three counts of aggravated battery with a deadly weapon and one count of carrying a firearm on school premises. His lawyers have said his no-contest plea acknowledged the “limitations in decision-making of an immature brain”.

Under New Mexico law, the state can charge minors as adults only if they are at least 14.

The Associated Press typically doesn't identify juveniles charged with crimes. - Sapa-AP