PHOENIX — An 81-year-old man who has spent most of his adult life behind bars for stealing from banks said he robbed a credit union in Tucson, Ariz., months after his release from prison because his monthly $800 Social Security payment wasn’t enough to live on, according to court records.

Robert Francis Krebs also told FBI agents that he didn’t wear a disguise to the January 2018 robbery because he “kind of wanted to get caught” and return to prison.

Details of the heist were revealed in court records filed Friday over whether Krebs, who turns 82 next month, is mentally fit to stand trial.

His lawyers say Krebs has reported having symptoms of Alzheimer’s disease, and a neuropsychologist concluded Krebs wasn’t competent to stand trial because he has dementia.

But two other mental health experts have said Krebs was competent and believed he was malingering, with one expert saying Krebs had “embellished or grossly exaggerated” his condition to avoid prosecution.

It’s now up to a judge to decide whether Krebs will head toward trial.

If found incompetent, Krebs could be sent to a facility in a bid to make him mentally fit. But if he can’t be restored to competency, his bank robbery charge could be dismissed, and he could be civilly committed, said Mike Black, a defense attorney in Phoenix who isn’t involved in the Krebs case.

It’s rare that charges are dropped because a defendant was found incompetent, Black said. “They never release them,” Black said.

In urging a judge to find Krebs competent, prosecutors said Krebs acknowledged to FBI agents that he carried out the robbery in Tucson because “$800 a month in Social Security is not very much to live on these days.”

William J. Rehder, a retired FBI bank robbery expert who isn’t involved in Krebs’ case, said it’s not surprising that people who spent decades in prison were ill equipped to earn a living once they are released. Prison provides them with stability, he said.

“They really can’t make it on the outside,” Rehder said. “He is right — Social Security is probably not enough to keep him going, and he has no prospects for income.”

Krebs served more than 30 years in prison for a 1981 bank robbery in Florida and was sentenced to three years in prison a 1966 conviction in Chicago for embezzling $72,000 from a bank where he worked as a teller. He also did another 17 years in Arizona for theft and armed robbery convictions from Arizona dating back to 1980.

Authorities say Krebs walked into the bank, put a handgun that turned out to be a BB gun on the counter, and demanded cash.

After walking away from the Tucson bank with nearly $8,400, Krebs told FBI agents he almost got struck by a vehicle while crossing a roadway, prosecutors said. He was later arrested at a hotel.