Jan 16 (Reuters) - A 12-year-old boy accused of opening fire with a shotgun at a New Mexico middle school, seriously wounding two students, has been charged with three counts of aggravated battery with a deadly weapon, authorities said on Thursday.

The boy, Mason Campbell, will be tried as a juvenile in connection with what authorities have described as a planned attack at Berrendo Middle School in Roswell, said New Mexico State Police Lieutenant Emmanuel Gutierrez.

Campbell is accused of taking a 20-gauge shotgun from his home and modifying it. With the weapon concealed in a duffel bag, he entered the school gymnasium and opened fire on students waiting for classes to start on Tuesday, police said.

Police have not revealed a motive for the attack, and investigators continue to look into the possibility that Campbell warned some friends before the shooting.

The charges against the boy were filed in children's court on Wednesday in the state's Fifth Judicial District Court. In accordance with New Mexico law, no one under age 14 in the state can face adult sanctions.

Two of the battery counts against Campbell stem from the wounding of two children in the attack, while the third is for an adult staff member who was slightly wounded and declined medical aid, police said.

An 11-year-old boy and a 13-year-old girl were seriously wounded and airlifted to the University Medical Center in Lubbock, Texas, where the boy was in critical condition and the girl was listed as satisfactory on Wednesday.

A hospital spokesman on Thursday said the facility would not be releasing any more information on their conditions until further notice.

PSYCHIATRIC DETENTION

The shooting incident lasted just 10 seconds before a teacher, identified as John Masterson, stepped forward and persuaded Campbell to put down his gun, officials said.

Campbell could face a potential maximum sentence of confinement in a juvenile detention facility until age 21, Roswell-based District Attorney Janetta Hicks of the Fifth District said in an email.

Campbell was being held at a child psychiatric hospital in Albuquerque about 170 miles (273 km) northwest of Roswell, the charging documents said.

A judge on Tuesday ordered the boy to undergo mental health evaluation and treatment, Hicks said. No hearings are currently scheduled in the case, she said.

"We are horribly sad over this tragedy on so many levels," they wrote in the statement, which was also signed by the boy's grandparents.

The shooting was the second at a U.S. middle school in the last three months and comes in the midst of a contentious national debate on gun control that intensified after a young gunman killed 26 people at an elementary school in Connecticut.

In October, a 12-year-old boy in Sparks, Nevada, opened fire at his school, killing a teacher and wounding two students before killing himself.

The Connecticut shooting at Sandy Hook Elementary in Newtown in December 2012 prompted President Barack Obama to call for sweeping new gun control measures.

Most of Obama's proposals were defeated in Congress, but his administration this month sought new regulations aimed at clarifying restrictions on gun ownership for the mentally ill and bolstering a database used for firearms background checks. (Reporting by Alex Dobuzinskis in Los Angeles and Karen Brooks in Austin, Texas; editing by Gunna Dickson)