03/24/2016 01:49 EDT | Updated 03/24/2016 01:59 EDT

Moncton Robber Caught After Unfriending Victim On Facebook

hE was sentenced Wednesday to three years in prison.

Johan Hedenstrom via Getty Images
A portrait of a man with a ski mask

MONCTON, N.B. — A Moncton man who robbed a sandwich shop was caught when he unfriended the victim on Facebook shortly after the heist.

Prosecutor Jessica Lavoie said 20-year-old Ryley Smith was sentenced Wednesday to three years in prison for robbery and masking his face during the commission of a crime.

Smith admitted threatening a Subway employee with a knife and getting away with about $1,000 in cash on Nov. 12, 2014.

Facebook tipped the victim off

Lavoie said Thursday that the victim soon noticed Smith had unfriended him on the social media site, which got him thinking that perhaps Smith was the masked robber.

Lavoie said the victim went to police, who obtained a warrant for a DNA sample, and matched it to a bandanna found in the Subway parking lot after the robbery.

Smith was arrested last November in Calgary, where he was then living.

Judge Irwin Lampert's sentence was for three-and-a-half years, including the equivalent of six months for time served since his arrest.