The New York Police Department would be barred from initiating investigations where race, religion or ethnicity is a "motivating factor" under a proposed settlement reached in two cases brought after Muslims were targeted for surveillance. 

City officials and the New York Civil Liberties Union announced the settlement in the two cases that alleged the police intelligence division broke the law by monitoring Muslims' religious activities, including at mosques. 

The settlement, which still has to be approved by a judge, was filed in federal court on Thursday. 

The city "did not admit to engaging in improper practices" in the settlement, the city's Law Department said. However, the settlement does "provide additional guidance to police." 

"We are committed to strengthening the relationship between our administration and communities of faith so that residents of every background feel respected and protected," Mayor Bill de Blasio said in a  statement. "New York's Muslim residents are strong partners in the fight against terrorism, and this settlement represents another important step toward building our relationship with the Muslim community." 

NYPD intelligence chief John Miller said in a statement that the "proposed settlement does not weaken the NYPD's ability to fulfill its steadfast commitment to investigate and prevent terrorist activity in New York City." 

According to the NYCLU, the settlement would also require the NYPD to document "factual information regarding possible unlawful activity" before it undertakes an investigation that focuses on political or religious activity. The city also said that the NYPD would need to consider "the potential impact on individuals," such as informants, "who may not be targets of investigations." 

Arthur Eisenberg, legal director for the NYCLU, called the settlement a "win for all New Yorkers." 

"It will curtail practices that wrongly stigmatize individuals simply on the basis of their religion, race or ethnicity," he said in a statement. "At the same time, the NYPD's investigative practices will be rendered more effective by focusing on criminal behavior."

The settlement would resolve two cases brought in 2013.