NEW YORK — A special New York Police Department unit that sparked controversy by tracking the daily lives of Muslims in an effort to detect terror threats has been disbanded, police officials said Tuesday.

NYPD spokesman Stephen Davis confirmed that detectives assigned to the unit had been transferred to other duties within the department’s Intelligence Division.

In a statement, Mayor Bill de Blasio, a Democrat, called the move “a critical step forward in easing tensions between the police and the communities they serve, so that our cops and our citizens can help one another go after the real bad guys.”

The Demographics Unit assembled databases on where Muslims lived, shopped, worked and prayed. Plainclothes officers infiltrated Muslim student groups, put informants in mosques, monitored sermons and cataloged Muslims in New York who adopted new, Americanized surnames.

After a series of stories by The Associated Press detailing the extent of the NYPD’s surveillance of Muslims, two civil rights lawsuits were filed demanding that the department halt the practice.

Since then, a review of the unit — renamed the Zone Assessment Unit in recent years — under new Police Commissioner William Bratton found that the same demographic information could be better collected through direct contact with community groups, officials said.

New York Civil Liberties Union Executive Director Donna Lieberman hailed the decision, saying police-community relations took a blow from the unit’s broad surveillance of Muslims, not just people suspected of wrongdoing.

“We hope this means an end to the dragnet approach to policing that has been so harmful to police-community relations and a commitment to going after criminal suspicion, rather than innocent New Yorkers,” said Lieberman, whose organization is involved in lawsuits over the practice.

In Washington, 34 members of Congress had demanded a federal investigation into the NYPD’s actions. Attorney General Eric Holder said he was disturbed by reports about the operations, and the Department of Justice said it was reviewing complaints received from Muslims and their supporters.

The AP’s reporting also prompted an investigation by the CIA’s inspector general. That internal inquiry concluded that the CIA, which is prohibited from domestic spying, hadn’t broken any laws, but criticized the agency for allowing an officer assigned to the NYPD to operate without sufficient supervision.

Then-Police Commissioner Ray Kelly had defended the spying tactics, saying officers observed legal guidelines.

The NYPD’s decision to disband the unit was first reported in The New York Times.

Copyright 2014 The Associated Press.