A Minneapolis man armed with a pellet gun tried to rob the wrong person when he approached an undercover detective, Eagan police said Saturday.

The man, 25, who had been staying with family in Eagan, had just robbed two other people with a pellet gun when he approached an Eagan plainclothes detective around 9 p.m. Thursday, police said.

Officers were in the area taking down the victims' reports when the man approached the detective in his unmarked car. The officer "arrested him after a short foot pursuit, tackling him to the ground," said Sgt. Linda Myhre.

The man already had robbed two men in the residential area near Coachman Road and City View Drive in Eagan, pistol-whipping one of them before running away, police said. Myhre said it appeared he was either looking for a third victim or a getaway car when he approached the undercover cop.

The suspect had painted the pellet gun black, she said, and it was dark, making it difficult to tell it wasn't a real gun.

The suspect is held in the Dakota County jail pending charges of first-degree aggravated robbery, second-degree assault and terroristic threats -- all felonies -- as well as fleeing an officer, a misdemeanor.

KELLY SMITH