The city could be days away from settling a federal lawsuit accusing the NYPD of “religious profiling” and unwarranted spying on Muslims even as the Paris massacres have heightened terrorism fears.

Lawyers for the city and Muslim leaders have told a judge they have “reached a settlement in principle” and will meet once more to iron out a few details before Wednesday’s deadline.

“I hope that whatever settlement is agreed upon, it does not tie the hands of the police,” Rep. Peter King (R-LI) told The Post, saying he supports the NYPD’s controversial surveillance program. “Take a look at Paris. You can see why these programs are necessary.”

The 2013 suit filed in Brooklyn federal court charged that after 9/11 the NYPD put informants, undercover cops and hidden cameras in mosques to monitor congregants and religious leaders “without any suspicion of wrongdoing,” and gathered information on law-abiding Muslims.

The city says it had good reasons to spy on the three Muslim leaders, two mosques and one charity who are plaintiffs in the suit.

For instance, Siraj Wahhaj, the imam of the Masjid At Taqwa mosque in Brooklyn, was an unindicted co-conspirator in a plot to bomb NYC landmarks in the mid-1990s, prosecutors said.

Mosque members ran paintball exercises for “jihad warriors” and survival training for “violent extremists” in multiple terrorism cases in the United States and abroad, including an aborted plot to kill soldiers at Fort Dix, NJ, the city contends. Members engaged in illegal weapons trafficking, ran a “gun club” and sent some of $200,000 it raised to several US-identified terrorist organizations, court papers say.

An NYPD source familiar with anti-terrorism efforts was defiant over the still-secret settlement.

“We’re not going to be intimidated or worried about any settlement in a lawsuit or what the court says we can or can’t do as intelligence officers,” he said. “We will do our job. If that means adjusting our methods a bit, then we’ll do that.”

The NYPD already works within legal guidelines, the source said.

“We can’t just go and infiltrate a political group or religious group,” he added.

Sources have told The Post that the plaintiffs, as part of any settlement, want the NYPD to remove a 92-page report — “Radicalization in the West: The Homegrown Threat” — from its site.

The 2007 report seems remarkably prescient. It warned of al-Qaeda-inspired jihadists in the US and abroad, hell-bent on attacking their host countries.

The suit also demands that the NYPD halt any ongoing surveillance in the Muslim community and expunge records from prior monitoring.