Tony Barber, 26, (left) and Niko Boswell-Johnson, 25, face charges related to an attempted robbery in Prince George's County. (Courtesy of Prince George's County Police)

Talk about timing: Two masked men tried to rob a pizza restaurant in Prince George's County while police were inside the business investigating a previous robbery there.

The incident occurred around 11:30 a.m. Sunday in the 9000 block of Annapolis Road in Lanham, officials said. Prince George's County police detectives were investigating an earlier robbery at the pizza restaurant when they saw two men wearing masks come to the front door.

As one of the robbers opened the door, the other spotted the police officer. The two men then ran to a nearby neighborhood.

One of the detectives followed and saw them get into a car. They were stopped shortly afterward, and three guns were found in their vehicle, police said.

The two suspects arrested and charged are Tony Barber, 26 of District Heights, and Niko Boswell-Johnson, 25, of Oxon Hill. They face charges of attempted armed robbery and other charges.

Authorities said they are trying to figure out if they are possibly linked to other robberies in the area.

In another, unrelated robbery, police said a smart-thinking detective went to a nearby Metro station after getting a report of a convenience store being robbed in Mount Rainer. The detective figured the man might try to use the Metro as a getaway, officials said.

And sure enough, police said, he did.

The detective, with help from Metro employees, found the suspect shortly after the incident on a train platform. He was taken into custody and officers found a loaded handgun, police said.

Police said that suspect is likely linked to additional robberies in the area. They did not immediately release his name.