BANGOR — A Rockport man has been sentenced to up to 12 years in prison for an armed robbery at a Millinocket pharmacy last summer.

Nicholas Skoby was also sentenced Wednesday to five years of probation upon release and ordered to pay Rite-Aid $250 in restitution for the prescription painkillers and other drugs he took during the August robbery.

The 30-year-old Skoby pleaded guilty in February to robbery and using, carrying or brandishing a firearm in connection with a crime of violence.

Skoby showed a handgun and led police on a high-speed chase before he was captured.

Skoby apologized to the pharmacist, who said she felt “terrorized,” and blamed the robbery on his drug use. He told the court he was high on alcohol, crack-cocaine, marijuana and bath salts.