It was the sort of discovery that is usually the mark of good police work: A Bronx detective came upon an online criminal enterprise that offered — for a low price — to hack into private e-mail accounts.

But the detective was not seeking to build a case against the outfit, federal prosecutors said on Tuesday. Rather, prosecutors said, he became a client.

Using information bought from the hackers, the detective, Edwin Vargas, obtained login information for at least 43 e-mail accounts associated with 30 people, including at least 19 members of the New York Police Department in the Bronx, according to a complaint unsealed in Federal District Court in Manhattan.

The reason for the digital snooping appeared to be personal, law enforcement officials said: Detective Vargas, 42, suspected a former girlfriend — also an employee of the Police Department, an official said — had started a new relationship with a fellow officer. Detective Vargas and the woman had a child together, officials said, but had broken up.