A Gaithersburg man was arrested hours after robbing a Frederick bank, police said Wednesday.

A masked man entered the Capital One bank at 1305 W. Seventh St., police said, taking money from a teller’s drawer after a bank manager told him he couldn’t get into the safe.

A witness gave police information about the suspect’s vehicle, a rented black pickup truck, authorities said. Officers soon found Ashref Adii Bannaga, 31, at a construction site near the parked truck, and he was later charged with armed robbery, theft and other offenses.

The gun and stolen money were recovered, according to the Frederick police.