Tamatea Intermediate School principal Roy Sye said the 12-year-old was discharged from Hawke's Bay Hospital yesterday morning and was in good spirits.
"We are very relieved that the incident wasn't more serious," Mr Sye said. "The total, total, total stupidity and randomness of someone discharging an air rifle in a built-up area next to a school is just unbelievable.
"I have no idea whether it was intentional or an accident or whatever, but it could have been a hell of a lot more serious."
The pellet was removed from the left side of the 12-year-old's back, about five inches above his waist.
"I have been in touch with the family since the word go and they are relieved but also incredulous at the stupidity and they want to know how the hell you can have teenagers with a gun without adult supervision shooting into a school."
Mr Sye said staff responded immediately to the incident.
"Luckily it was after school with fewer students around. I don't think people appreciate that 12-year-old shot in the back with modern air guns can be lethal, are lethal. Kids are given access to those things without realising or understanding the actual power."
Hastings Police Senior Sergeant Stuart Fleming said police could not comment on the matter now it was before the courts, but had concern about any youth accessing firearms.
To be in possession of a firearm you need to be a licensed firearms holder.
"In any given year police will attend a number of incidents from air rifles being used unlawfully in residential areas," Mr Fleming said. "Firearms are essentially dangerous items and require a good deal of care in their use. The use of any firearm including air guns by persons who are not trained or have the basic legal requirement to have the weapon makes it even more dangerous.
"There's obligations when owning a firearm to express extra care and when you have teenagers using firearms in residential areas it is not only dangerous but because there [are] houses around, and schools as in yesterday's case, is unlawful and dangerous."