The 10th Circuit Court of Appeals decision on Monday ruled that the officer and educators named in the lawsuit were entitled to immunity, and the arrest was justified under a New Mexico law that prohibits anyone from interfering in the education process.

The student was a seventh-grader at Albuquerque's Cleveland Middle School at the time of the May 2011 arrest. He is not named in court documents.

His mother, who also isn't named, filed the lawsuit against the then 13-year-old's principals and the police officer who escorted him to his patrol car before patting him down, cuffing him and taking him to a juvenile detention center. He was held for an hour before his mother arrived.

She argued her son's arrest was unlawful and resulted in excessive force.

"At worst, (the boy) was being a class-clown and engaged in behavior that would have subjected generations of school boys to an after-school detention, writing lines, or a call to his parents," a complaint filed by her attorneys said.

According to the school, the boy was in physical education class when his teacher said he began making other students laugh with fake burps. The teacher sent him to the hallway, where he continued burping and leaning into the entranceway to the classroom so the students could hear.

That's when Officer Arthur Acosta, assigned to the middle school as its resource officer, was called to the hallway where the boy was seated, according to court documents.

The boy disputed the version of events provided to the officer by his teacher Margaret Mines-Hornbeck before the officer led him away from the classroom, and took him first to the school's administrative office and then the juvenile detention center.

The boy was suspended for the remainder of the school year.

The appeals court also ruled Monday on a separate complaint brought by the boy's mother stemming from a school official's decision to search the boy in the November after the burp-related arrest.

Court documents show the assistant principal who suspected the teen may have been involved in a marijuana transaction asked him to remove his shoes and jeans, and flip the waistband of a pair of shorts he was wearing under his jeans. The boy was wearing several more layers of clothing under the jeans.

The search turned up a red bandanna, a belt buckle with the image of a marijuana leaf and other items but no drugs.

The mother argued the school official engaged in an unlawful strip search of the boy. But the court found the use of the term "strip search" was a stretch and did not violate the boy's constitutional rights.

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