The 21-year-old who allegedly robbed a Yarmouth pharmacy, sparking a high-speed police chase that ended when he crashed his car near Freeport, was a few weeks away from a sentencing hearing for a previous crime, authorities said.

Dylan Libby was arrested Jan. 27, 2010, for alleged burglary and theft, according to the York County Court Clerk. His case was placed on deferred disposition, with a final sentencing hearing set for May 14.

But Libby allegedly held up the Rite Aid Pharmacy in Yarmouth on Wednesday, rammed his car into a police officer’s vehicle, and then fled on Route 1 north and then onto I-295.

Libby’s vehicle rolled over when he tried to exit I-295 at Exit 22 in Freeport, injuring him and a passenger, Madeline Damon, 18.

Authorities arraigned Libby Friday in his hospital room at Maine Medical Center, charging him with robbery and eluding police, said Cumberland Assistant District Attorney Matt Tice.

Additional charges are likely, Tice said. Damon has not been charged.

Libby was ordered held on $100,000 surety or $50,000 cash, said Tice.

“This is a work in progress,” he said.