It can be tough to make ends meet when you’re a senior, so perhaps David Walsh recognized a kindred spirit when he allegedly suggested a way they could both make some cash: rob a bank.

Unfortunately, the 71-year-old Walsh’s acquaintance didn’t share his enthusiasm when they discussed the proposal at a North Side senior rec center on July 13, according to federal prosecutors. Perhaps that’s because the other man happened to be an undercover government informant.

Walsh, who allegedly chose to go solo in a how-not-to-rob-a-bank misadventure, is due in court Wednesday at the Dirksen Federal Building.

Walsh, who lives in the city, is charged with the July 14 armed robbery of a U.S. Bank at 4725 N. Western Ave. in the Lincoln Center neighborhood, according to a criminal complaint filed in U.S. District Court.

Walsh, wearing a “clown mask” and brandishing a revolver, made off with $3,700, prosecutors said.

Then things went very wrong.

Walsh slipped into an alley near the bank, peeling off his mask and changing clothes — all of which was caught on a video surveillance camera, prosecutors say.

Walsh then used a Ventra fare card — registered in his own name — to board a train at the Brown Line’s Western stop. That too was captured by surveillance video, prosecutors say.

Six days later, the confidential informant Walsh met at the rec center went to the authorities. The informant described how Walsh had suggested robbing a bank, then talked about making more money by doing “smaller, quick jobs,” according to the complainant.

It’s unclear from the complaint how the informant happened to be at the rec center or how he encountered Walsh.

Walsh showed the informant a bag containing, among other things, a “big black revolver in a holster,” prosecutors say.

Walsh approached the informant twice more at the rec center — both times after the July 14 bank robbery. The informant turned down an offer to act as a getaway driver, prosecutors say. But the informant agreed to drive Walsh around so that Walsh could “mark a spot.”

On July 24, federal agents secretly followed Walsh and the informant driving a car toward a branch of TCF Bank in the 4900 block of North Milwaukee. They watched, as Walsh got out of the car, change his clothes and put an “object in the front waistband of his pants.”

Shortly after the car arrived at the bank, federal agents swooped in and arrested Walsh.

Contributing: David Struett