A judge rejected an argument that he should find exceptional circumstances were present to spare Gary Owens the minimum five-year prison term set down by Parliament.
Lord Uist told him: “This all arose from your manufacture and possession of two home-made, improvised, short barreled weapons which constituted firearms.”
“You also had ammunition suitable for use in them and had fired one of the devices at your door,” said the judge.
He noted that Owens stated intention in having them was in order to commit suicide if he was inclined to do so.
But Lord Uist said they could have come into the hands of others who could have used them for any purpose they wished.
He pointed out that Owens had a lengthy criminal record and a chronic drug abuse problem.
He said Owens had made the devices knowing the harm they could cause.
Owens created the weapons in his flat and test fired one in his hallway where shotgun pellets were found embedded in a door.
He told police that the last one he manufactured took him a couple of hours to make.
Advocate depute Susanne Tanner earlier told the High Court in Edinburgh: “He claimed not to have researched it in anyway on the internet saying he had never used a computer in his life.”
Unemployed Owens, 38, said he had built the firearms through a process of trial and error and had bought matches and party poppers to supplement parts he had found abandoned.
The former roofer and plumber who suffers from depression, told detectives that he thought it might be a way to commit suicide.
He said the home-made firearms were for “if things got too much it was for suicide”.
He said he had been testing them to see what worked best because he did not want to end up a vegetable relying on everyone else and that he “just wanted to be gone”.
Owens previously admitted a string of firearms offences committed between February 1 and April 16 this year at his home in Jamaica Mews, in Edinburgh, including manufacturing a prohibited weapon and possessing homemade firearms.
Defence solicitor advocate Robbie Burnett earlier said of Owens: “He is very much a loner. He tells me he has no real friends.”
“He has been depressed for some considerable time and had on various occasions attempted suicide,” he said.
The advocate depute told the court that in April this year the police received intelligence over Owens manufacturing firearms at his home.
When detectives arrived he said words to the effect of “is this because I make things”.
A specialist search team was brought in including an Army sergeant who is an ammunition technician.
He found two improvised short barreled weapons in the living room of Owens flat where he lived alone. He decided that both were capable of firing.
Xrays were taken and one showed that a metal ball bearing was probably in the barrel of one weapon. An explosive from match heads could be ignited by a wire pull.
Police also recovered shotgun cartridges, pellets and ball bearings in a plastic Kinder egg container.
Damage to the inside of the front door was looked at and forensic scientists said it was consistent with a shotgun being fired, but they could not rule out a non-conventional gun being used such as a homemade or modified firearm.
Tools such as drills, grinders and files were also found during the search.
Jobless Owens said he had been “tinkering about” with the devices found at his home.
He said he did not know if they would be classed as guns and stated that he thought he would be dead by the time they were found.
Owens said he would have smashed them up with a hammer if he decided not to use them on himself.
Mr Burnett maintained: “This is not a case where the minimum of five years in prison should be imposed.”
He said it seemed the purpose of the relevant legislation was to stop a weapon getting into the public domain which would then be used in committing a crime.