Andrew Rogers, 26, had resorted to raiding off licences by night while teaching A level maths at the Weald of Kent Grammar School for Girls in Tonbridge, Kent, by day after running up debts playing fruit machines in a snooker club.
After a short, and rather unsuccessful criminal career, Mr Rogers, a keen Salvation Army member, had made only pounds 1,000.
As well as moonlighting at Sainsbury's as a cleaner before school he took to raiding Unwins and Victoria Wine shops using an unloaded air pistol and a scarf. He got the idea after shooting his air pistol at targets in the back garden of his home in Tonbridge.
His defence barrister, Andrew Rodger, told Maidstone Crown Court that he would give up at the slightest resistance from staff and had finally broken down after being chased by a shop assistant with a hammer.
He said: "In floods of tears he told his brother, but he was going to wait until after a school trip to London before going to the police, because he didn't want to disappoint his pupils."
His brother persuaded him to confess to his mother, who went with him to the local police station. Rogers, who seemed bewildered when he finally gave himself up, told the police: "It was as though some-one else was doing the robberies. It didn't dawn on me until I was being chased down the street by a man with a hammer."
He jailed for four years by Maidstone Crown Court yesterday after pleading guilty to three robbery charges and three charges of having a firearm with intent. Staff still working at the school during the summer holidays said only that Rogers had left "by mutual consent" on 2 June.