A 23-year-old man suspected of armed robbery tried to take an Uber car to help him get away after he held up a store outside Baltimore, police said.

The suspect, Dashawn Terrell Cochran, was at a store in Parkville, Maryland, early Wednesday morning when he allegedly took a bottle of Tylenol cold medicine to the register, the Baltimore County Police Department said. Police said he then pointed a gun at an employee and demanded money.

Cochran ran from the store with an undisclosed amount of cash, but officers began to track his path, police said.

Cochran was seen getting into the back of a silver Lexus, and when officers pulled the car over, the driver said he was an Uber driver, police said.

The driver and a second passenger were released since it was determined they "had nothing to do with the robbery," police said.

Cochran was charged with armed robbery, first-degree assault, second-degree assault and theft less than $1,000, Cpl. John Wachter of the Baltimore County Police Department told ABC News. Cochran was being held at the Baltimore County Detention Center as of Saturday, said Wachter.