Cash to buy heroin to alleviate back pain drove Scott Robert Thomas to load a syringe with coffee and rob two service stations, a court has heard.
But the short-term fix landed Thomas, 39, a four-year jail sentence.
Thomas appeared for sentence before Chief Justice Helen Murrell in the ACT Supreme Court on Thursday, after pleading guilty to three offences.
The crimes took place after Thomas was denied opiate-based medication for his back pain. He became distressed and said methadone was not enough relief.
The court heard the offender threatened an employee at a Lonsdale Street service station with a syringe on August 9.
Thomas escaped with $160 cash, saying "enjoy your stress leave" as he fled.
He used the money to buy heroin, but his back pain returned about midnight.
Thomas then went to a second service station about 12.30am, pointed a coffee-filled syringe at the staff member, and said: "I'm gonna stab you with this, give me the money."
But the employee could not open the register and then managed to press the duress alarm when Thomas was distracted.
Thomas jumped the counter and stole tobacco, sunglasses, and phones before escaping on a bicycle.
He was arrested in Reid about 2am.
The court also heard Thomas had earlier tried to snatch cash from a register at a Canberra Centre supermarket, but had been thwarted when the employee slammed the drawer on his fingers.
The court heard he had left home at 15, and had an entangled history of mental illness and drugs.
A warrant had been out for his arrest since 1998, the court heard, but he led a largely itinerant lifestyle and had been homeless.
Chief Justice Murrell said the syringe was not a real risk, because it was clean and was only filled with coffee.
But she said the staff had no way of knowing what the substance was.
Thomas' defence barrister Anthony Hopkins told the court his client had suffered a serious back injury about seven years ago which continued to cause him pain.
He said he committed the heists in order to buy heroin to kill the pain.
"He did not intend to harm anybody," Mr Hopkins said.
Chief Justice Murrell sentenced Thomas to four years and one month imprisonment, with a non-parole period of two years and two months.
The sentence will be backdated, meaning he will be eligible for release in October next year.