Louis Crosby "naively" converted his savings into a digital cash investment but had been the victim of an online scam and lost the lot.
Newcastle Crown Court heard within an hour of finding out all of his money had gone, the 25-year-old walked into a Premier shop, armed with a pistol and ordered "give me the money, I have a gun."
However, the store owner and the worker behind the till put up an "astonishing" fight, knocked the weapon out of his hand and kept him there until the policearrived.
One person taken to hospital after North East Air Ambulance lands at Roker Beach
Two taken to hospital after collision closes A690 near Ramside Hall Hotel
Fresh bid to convert former council offices in Hetton into flats
Troubled woman caused £30,000 damage by setting fire to her Gentoo home in Sunderland
Careless driving, no insurance and fare-dodging – the latest Sunderland court cases
Crosby, who has never been in trouble before, has now been given a suspended prison sentence after a judge said the cryptocurrency "disaster" plunged himinto a mental "crisis".
The court heard Crosby had put his hood up, covered his face in a scarf and slipped on sunglasses before he went into the shop on St. Luke's Road in Sunderland at around 10.50pm on November 27 last year.
Proscutor Neil Pallister told the court: "The defendant approached the counter and the complainant saw a gun pointing towards him, through the gap at the bottom of the perspex screen.
"The defendant said 'give me the money, I have a gun'."
The court heard instead of cowering away, the brave shop worker walked towards the armed raider, despite the gun still being pointed at him.
And when the shop owner heard the commotion, he pressed the panic alarm and then stepped in to help.
Mr Pallister said the shop owner picked up a broken broom handle to use in self-defence because he "feared for his life".
The shop worker then grabbed at the gun and pointed it away from himself managing to knock it out of Crosby's hand.
Mr Pallister added: "The defendant tried to escape, however they were able to detain him until the police arrived."
When Crosby was arrested he claimed "it was a joke".
Crosby, of Portobello Road, Sunderland, who has never been in trouble before, admitted attempted robbery and possessing a firearm at the time of committing an offence.
The gun was an air pistol with a self contained gas cartridge but was not loaded at the time.
The court heard Crosby is an undergraduate who was due to marry a Singaporean national, who he met on the internet.
Nicholas Lane, defending, said Crosby sponsors a child in Mali and does charitable work with the Islamic Community at Sunderland University after converting to the faith and it is "quite remarkable" he committed the offence.
He added: "The explanation for why he came to offend in this way is he had somewhat naively invested his savings he needed for a wedding dowry and for hisrent into cryptocurrency and he himself had been scammed, a victim of crime.
"In clearly a moment when he wasn't thinking straight he took up an air pistol, which he had bought off the internet, and committed this offence."
The court heard Crosby remains engaged, although the first wedding was cancelled due to covid and the second wedding cancelled due to offence.
Judge Julie Clemitson said she had read testimonials to Crosby's ordinarily positive character and generosity and said she accepted his "shame and remorse"were genuine.
The judge said a doctor who assessed Crosby, who has a history of mental health problems, assessed the offence was an "impulsive act in response to the loss of all of your savings".
Judge Clemitson added: "It is apparent, within an extremely short period of time, within an hour, you made the decision to commit this offence.
"You must have been in a state of crisis to have acted in such a desperate manner, with thoughts swinging from taking your own life to committing financial crime to get yourself out of the situation."
Judge Clemitson said Crosby must have been in a state of "mental turmoil" at the time of the offence, which was triggered by being a victim of crime and losing the money he had worked hard to save while a student and working nightshifts.
Crosby was sentenced to two years imprisonment, suspended for two years, with rehabilitation requirements and a 12 month 7pm to 7am curfew.