A teenage girl who photographed herself clutching a knife before using it to commit armed robbery has been convicted of the crime after officers used the selfie as evidence against her.

The 17-year-old girl and an accomplice robbed a Max hamburger restaurant in Halmstad, southern Sweden in March this year, according to reports in the Swedish edition of news website The Local.

In advance of committing the crime, the girl used her smartphone to take pictures of herself and another girl wearing balaclavas and holding the large, 30cm kitchen knife – evidence police later used to apprehend her.

Download the new Independent Premium app Sharing the full story, not just the headlines

According to The Local, the girl and her accomplice took 2,420 kronor (£230) from the diner. A court heard witnesses say the girl held up restaurant staff with the knife and shouted: “Give me the money or I’ll stab you”.

Police with sniffer dogs tracked two girls down just 47 minutes after the crime took place. They initially found a bag filled with money and the phone with the pictures on it. They were able to trace the pair back to the home of the convicted girl’s grandmother, at which point the two told officers they had just returned from a walk.

On Friday, the older of the two girls found at the home was convicted of the crime and sent to juvenile detention. The court heard in mitigation that she came from a difficult background, and had been thrown out of her family home. She will receive help from a youth psychiatrist, and was told her sentence would have been far stricter had she been 18 years old.

The Local reported that among other evidence found on her phone, including more selfies and a picture of the loot, police found a quote by US poet Ralph Waldo Emerson, which said: “Commit a crime and the world is made of glass.”