By Letitia Stein

(Reuters) - A Florida man pretending to be a law enforcement officer faces charges after he pulled over a real detective, authorities said.

Matthew McMahon flashed blue and red lights to pull over a detective in an unmarked vehicle in the St. Augustine area of northeast Florida on Monday evening, St. Johns County Sheriff’s officials said.

The detective’s suspicions were aroused, but he needed to investigate further before he could arrest McMahon.

The next day, officers obtained a warrant to arrest the 20-year-old St. Augustine man. Unaware of the warrant, McMahon came to the sheriff’s office at lunchtime to relinquish the emergency lights, said police spokeswoman Catherine Payne.

The detective who had been pulled over happened to walk into the lobby just in time for the arrest.

“Once again, a chance encounter makes the arrest,” Payne said.

McMahon was charged with impersonating an officer and released on bail on Tuesday night. It was not immediately clear if he had an attorney.

(Reporting by Letitia Stein in Tampa, Fla., Editing by David Adams; Editing by Peter Cooney)