A 71-year-old terminally ill man has been sentenced to 21 years in a California prison for rolling his wheelchair into a San Diego bank and holding it up with a replica BB gun.

Judge Jeffrey Fraser said Friday that Peter Lawrence could theoretically get out of prison at age 90, when he would no longer be a threat to the public.

According to City News Service, Lawrence told the judge he robbed the Chase bank of more than $2,000 this summer because he felt hopeless after being diagnosed with a myriad of medical problems.

Defense lawyer Kenneth Kaminiski says his client did not want to harm anyone. Kaminiski says Lawrence wanted to get caught so he would not have to live on the streets.

Prosecutors said Lawrence was a danger because he could use a real weapon in the future.