A high-ranking prosecutor in the Brooklyn district attorney’s office was arrested this week on charges that she used an illegal wiretap to spy on a police detective and one of her colleagues in what a law-enforcement official described as a love triangle gone wrong.

The prosecutor, Tara Lenich, was taken into custody on Monday and fired after investigators in the district attorney’s office learned over Thanksgiving weekend that she had conducted the illicit surveillance because of “a personal entanglement between her and the detective,” according to the law enforcement official, who spoke on the condition of anonymity because of the delicate nature of the case.

The authorities did not release the name of the detective, a man, or Ms. Lenich’s colleague, a female assistant district attorney.

Ms. Lenich was arraigned on Monday night and released on $25,000 bail.

Before her arrest, Ms. Lenich, 41, was a deputy chief of the Violent Criminal Enterprises Bureau in the district attorney’s office; it specializes in using tactics like wiretaps to combat criminal gangs and drug organizations.