A New Brunswick sandwich shop was robbed of about $1000 by a masked man with a knife back in November of 2014. The culprit was sentenced this week. And the police fingered him out after the victim was unfriended on Facebook.

Nastco/Thinkstock

The Moncton man was arrested after he unfriended the victim on Facebook shortly after the robbery.

According to the Canadian Press, 20 year old Ryley Smith was sentenced this Wednesday to three years in prison for robbery and masking his face during the commission of a crime.

Smith admitted threatening the Subway employee with a knife and making off with the $1000 in cash.

Prosecutor Jessica Lavoie said the victim noticed that Smith unfriended him on Facebook, which got him wondering if perhaps Smith might be the masked robber.

Police obtained a warrant for a DNA sample and compared it to a bandana found in the Subway parking lot. The two samples matched.

Smith was arrested in November. He was sentenced to three-and-a-half years, including the equivalent of six months for time served since his arrest.