PORTLAND — A 23-year-old Maine man faces up to 20 years in prison after pleading guilty to robbing a pharmacy.

The U.S. Attorney’s Office says Nicholas Alexander entered his plea Tuesday in federal court in Portland.

Police say Alexander and others robbed a Walgreens pharmacy in Bath in June. During the robbery, Alexander handed a pharmacist a note demanding oxycodone tablets or he’d “blow his brains out.”

Alexander was later arrested at a motel in Wiscasset with 600 oxycodone tablets. He told police he’d used some and sold others.

Another 23-year-old man from Dresden was also charged.