A grammar school in Northern Ireland has lost a High Court challenge to the reinstatement of a pupil expelled after allegedly trying to buy a sub-machine gun and ammunition.
Its board of governors issued proceedings following an appeals tribunal's finding that permanent exclusion had been a disproportionate step against a boy aged 14 at the time.
Neither the school nor the pupil are being identified to ensure his anonymity is protected.
He was arrested at a retail park in Coleraine, Co Derry in April this year following a police operation.
The teenager has been charged with attempting to purchase a sub-machine gun and 100 rounds of live ammunition with intent to endanger life.
At the time he was released on bail while the criminal case continues.
The decision to expel him from school was subsequently overturned on appeal, resulting in his return to the classroom in September.
Lawyers representing the board of governors were seeking to judicially review the outcome of the tribunal.
They argued that the appeal body erred in law by disregarding the incident which led to the pupil's arrest.
Counsel for the tribunal, Paul McLaughlin, countered by insisting it should have been ignored in the disciplinary process because the police investigation remained incomplete.
"Expulsion, leaving that matter out of account, was a disproportionate response," he argued.
A barrister representing the boy described him as a "dedicated, ambitious young man" in a critical GCSE year of study.
She told the court he has complied with all bail conditions and is being monitored to ensure he cannot leave school grounds during break and lunch.
"He showed no resistance to going back to school, indeed he wished to go back there," she added.
Ruling on the application for judicial review, Mr Justice McCloskey acknowledged the board of governors faced complex legal duties in stressing and pressing conditions.
But he identified flaws in how the process was handled after receiving information from police.
"In short, the board did not perform the necessary duty of inquiry to the requisite extent," the judge held.
Dismissing the challenge, he added: "More was required of the board of governors in response to the information prior to reaching an expulsion decision.
"That is what the tribunal was seeking to convey, in my judgment, in its use of the language of a disproportionate response."