ADRIAN — An Adrian man who spent more than 20 years in prison for a robbery conviction was sent back Thursday to serve another 17 to 40 years.

“I just ask that this court have mercy on me,” David Daniel Byard, 49, said before his sentencing in Lenawee County Circuit Court. He pleaded guilty last month to an armed assault of a CVS pharmacy worker on April 20.

Byard was caught minutes after the assault as he ran through a city park next to the Lenawee County Jail.

Mental health issues are behind Byard’s behavior and were not dealt with during his years in the state prison system, said public defender Anna Marie Anzalone.

Byard was sentenced to prison in 1989 for an armed robbery at Domino’s Pizza in Adrian. He was discharged in October 2011 and found work at a local retail store. The store owner said he was good employee and even trusted him to make bank deposits, Anzalone said.

“Never a penny was missing,” she said.

But Byard told her he could not stop himself from robbing somewhere else, she told the court.

“I want to apologize to my family,” Byard said. He could not be present when his father and other relatives passed away, he said. At one point he turned to look at his mother in the audience to apologize.

“I do understand that the events of your life and your behavior have an effect on all the people in your life,” said Judge Margaret M.S. Noe.

His history of property crimes that escalated to the previous armed robbery conviction showed probation and parole had not worked for him, Noe said.

“The use of guns is always a serious consideration,” Noe said.

The sentence she handed down was the maximum allowed under state guidelines for the charge of assault with intent to rob while armed.

Byard was charged with twice going to the CVS store to commit robbery during April. On April 8, a security camera recording showed a man holding a pistol walked into the store and stole from an unattended check-out counter.

About 1 a.m. on April 20 the same man confronted a clerk at the store.

“I pointed the gun at him, he ran and I left,” Byard said at his plea hearing.

Noe ordered that Byard receive mental health treatment in prison. She also ordered that he pay $240 restitution to CVS.