Fredericton police cruiser

The Fredericton Police arrested a 23-year-old man after an attempted robbery on Friday. (CBC)

A man is in custody after an attempted armed robbery early Friday morning in Fredericton.

Fredericton police say a taxi showed up to pick up a person in the parking lot of the Petro-Canada on Royal Road at about 1:30 a.m. That is when a passenger got into the cab, brandished a weapon and demanded the driver turn over money.

Sgt. Tim Sowers said the driver jumped out of the car and the would-be robber got into the driver's seat.

However, a second cab arrived on the scene and the suspect ran away.

Sowers said the suspect was seen going into a residence on Hawkins Street.

Police surrounded the building and a 23-year-old man surrendered a short time later.

He is expected to appear in court on Friday.