A bank robber in West Virginia was caught thanks to the cabbie who drove him to the alleged heist, police said.

Cab driver George Lyon told the Associated Press he picked up Ryan Michael Stepanian, 25, at an apartment complex Monday and drove him to a Charles Town bank, for what Stepanian said was a routine matter.

After Stepanian left the bank, Lyon dropped him off at a park.

Soon after, Charles Town police were dispatched to the City National Bank at 1034 South George Street.

Meanwhile, Lyon said he subsequently recognized Stepanian’s photo on social media from an earlier bank heist Friday in nearby Ranson and immediately notified police about his latest fare.

Charles Town police said in a news release Stepanian was apprehended on foot sometime later. Stepanian reportedly had an undisclosed amount of U.S. currency and a bank robbery note on him.

Stepanian confessed to the bank robbery as well as the one at Ranson's BB&T bank, officials said.

Ranson police confirmed Tuesday a warrant had been issued charging Stepanian with the bank robbery at the BB&T bank.

In the Friday incident, police said the robber handed a teller a note demanding money and claimed he had a gun, though no weapon was displayed, the Herald Mail Media reported.

Stepanian was being held on two counts of bank robbery. It was not immediately known if he has an attorney.

The Associated Press contributed to this report.