Now this is counter intelligence.

A heroin-hungry St. Cloud teller plotted with his drug-supplying pal on the customer side of the counter at a Wells Fargo branch in a robbery that netted more than $23,000. But investigators soon got wind of the bank heist conspiracy and spoiled the duo’s script.

Now both men, described as friends and fellow drug abusers, are in jail and were charged Friday with felony aiding and abetting theft for the holdup early Tuesday afternoon at the bank at the corner of 33rd Avenue and 2nd Street.

Police identified the teller as James L. Hagburg, 23, of St. Cloud. Cast in the role of “the robber” was Drew T. Coldiron, 27, of Minneapolis.

According to the criminal complaints and police:

Coldiron approached Hagburg behind the counter and handed him a note on a piece of cardboard demanding money while his other hand was in his sweatshirt pocket, implying he was armed.

Hagburg gave Coldiron more than $23,000 — an unusually large sum compared to most bank robberies — and “watched him walk out of the bank.” The teller didn’t reveal Coldiron’s identity, but gave police a description that included the suspect having a missing tooth.

That same afternoon, police distributed a surveillance photo of the robber to news media outlets, and quickly there were “multiple people calling” tips into authorities, said Police Lt. Jeff Oxton.

Not only did people identify Coldiron as the robber but also revealed that he and Hagburg were once employed at the same workplace and were both illicit drug users.

Questioned again by authorities, Hagburg admitted knowing Coldiron and said he “depended on [him] for heroin.”

Knowing Coldiron was interested in knocking off a bank, Hagburg said he’d help and not snitch on Coldiron in exchange for heroin.

By Thursday, both were in jail. Neither police nor prosecutors have said whether any of the money has been recovered.

“It’s rare that we run across a situation where a bank employee has worked with a robber,” said Kyle Loven, the FBI’s spokesman in Minneapolis, whose agency assisted in investigating this case.

In 1997, a similar plot unfolded at a Bank of America branch in San Diego, where teller Shabir Rahim turned over nearly $24,000 to cohort Hamdani Setiono. Both were caught and admitted to the plot but blamed each other for dreaming up the idea.