A Windham man was sentenced Thursday to two years in prison for robbing a pharmacy last year by threatening employees with a knife tucked into his waistband.

Derek Jackson, 38, was turned in by family members soon after he robbed the pharmacy at the Hannaford store on Roosevelt Trail in Windham on March 23 and escaped briefly with a bag of hydromorphone pills, a narcotic painkiller, according to documents filed in U.S. District Court in Portland.

One of Jackson’s relatives told police within minutes after the robbery that Jackson had called on the phone, saying, “The cops are behind me.”

Moments after that call, a second family member called a police dispatcher, expressing concern about Jackson.

Jackson was heard in the background on that call, on a different phone, yelling, “I robbed a … pharmacy” and “I’m gonna take all these pills and die in peace,” said FBI agent Thomas MacDonald in an affidavit seeking a charge against Jackson.

When police arrived at Jackson’s home, family members were there and Jackson was inside in an “apparent overdose state.” He was taken away by ambulance, according to the report.

Jackson pleaded guilty in October before Judge George Singal to a single count of interference with commerce by robbery.

The judge also sentenced Jackson on Thursday to serve three years of supervised release after he completes his prison term.