A Michigan man charged with robbery of a Hardee’s restaurant told his lawyer he committed the crime so that he could return to prison.

Mark Wilson, 59, was sentenced to between 25 and 40 years in prison, an enhanced sentence because this was his fourth offense.

On July 9, a 911 dispatcher received a call that a man passed a note to a cashier at a Hardee’s restaurant in the Upper Peninsula town of Escanaba, Mich. saying that he was robbing the place.

MICHIGAN MAN WHO RAN OVER, KILLED DEPUTY SENTENCED TO LIFE WITHOUT PAROLE

Wilson then went into the restroom and stayed there until officers arrived. Police officers talked Wilson into exiting the restroom and arrested him. No firearms were found.

Defense attorney Tim Cain said Wilson told him he committed the crime so he could return to prison.

MICHIGAN MAN'S TOE TO REPLACE THUMB SAWED-FF IN WOODWORKING ACCIDENT

Wilson “tells me he’s happy enough with 25 to 40,” Cain said of Wilson’s maximum sentence.

Wilson told the court he felt unable to adapt to the outside world.

“Somewhere along the road, your honor, I just seemed to have lost the ability to function normally with society,” Wilson told a Delta County judge. “I would like to say to the people that I apologize in the most sincere manner for my behavior” last July.

Judge John Economopoulos granted Wilson his wish.

“If this outside world is a hostile environment for you, and the inside world of the Department of Corrections is the institution in which you’re most familiar… then my message to you is this: If you cannot be or do not desire to be a law-abiding citizen on the outside, at least do your very best to be a model on the inside,” the judge told Wilson.

CLICK HERE TO GET THE FOX NEWS APP

Wilson’s record shows convictions in three different counties dating back to 1983. He was last released from prison in 2012 and completed parole in 2014, the Corrections Department said Thursday. His last conviction was for an unarmed robbery of an Arby’s in 2009.

The Associated Press contributed to this report.