According to Daily Star UK, the teen stole the weapon from his dad’s cabinet and sneaked it into the building under his clothes along with a knife, mask and ear-plugs.
As he got ready to open fire in a side room the schoolboy had a “change of heart” and dialled 999 instead.
He told a call-handler he had mental health problems and had been thinking of harming others.
Of the gun the teen said: “I don’t know why I’ve got it. I just felt so angry this morning. I had to get it out. I haven’t done anything with it.”
Asked by the operator who he was planning to use the weapon on he replied: “Someone else…anyone.’’
Armed police swooped on Higham Lane School in Nuneaton, Warks, and the boy was detained.
Leamington Youth Court heard the incident could have had “appalling” consequences similar to the Sandy Hook, Virginia Tech and Columbine High School massacres in the US.
Today the boy, who cannot be named for legal reasons, admitted possessing the shotgun and the cartridges with intent to endanger life.
He also pleaded guilty to having a folding pocket knife with a blade longer than 3in.
The teen was granted bail on the condition he lives at an address outside the area and complies with an electronically-monitored 7pm-7am curfew.
Omar Majid, prosecuting, said the gun was legally kept in a locked cabinet.
The boy smuggled it into school without anyone noticing and went into class as normal.
But he left and went into a nearby room to take out his weapons.
Mr Majid said: “Fortunately at that time he had a change of heart and decided to call the police.
“When he called 999 he told them what he was originally thinking of doing.
“It could have been an appalling situation the like of which the court is aware of in the US.
“When he was interviewed he said he had taken the gun and ammunition because he intended to harm people at school because he was feeling very low at the time, and that he regretted his actions.’”
The boy said he wanted to kill himself.