The 60-year-old man, who had no previous convictions but significant debts, wore a hat, fake moustache and sunglasses, when he entered a bank in Hiddenhausen, eastern Westphalia, with a loaded nine-millimetre pistol, according to theWestdeutsche Zeitung.
He demanded €50,000 from the only bank employee present at the time – but she was not able to open the safe.
The man then reduced his demand to €10,000 before abandoning his attempt and running off - fearing that the shocked female clerk would call the police. Two days later, he handed himself in, the court in Bielefeld heard.
Presiding judge Georg Zimmerman referred to the crime as "an act of desperation" adding that the motive of helping his granddaughter had been an honourable one. The girl, now eight, was born with a heart defect and had already undergone several operations.
The family's health insurance did not cover some of the treatment that would help alleviate the effect of the disease and surgery, the man's defence lawyer said in a closing statement. The man himself had also been left with €150,000 in debts after a fire at his furniture business the German news magazine Der Spiegel reported on its webite.
The defendant was placed on probation for two years. "Go home and look after your family," the judge said.
Both the defence and the prosecution had called for a suspended sentence because the man had stopped the attack after realising he would not be successful.
Comments on the magazine website were broadly supportive of the man, with complaints levelled at the health insurance system.