When even the Legal Aid Society opposes a bill that ties cops’ hands, you can be pretty sure it’s fatally flawed.

Alas, the concerns of Westchester’s LAS — and a raft of law-enforcement and other groups — didn’t stop the county Board of Legislators from passing the Immigration Protection Act by a 10-5 vote this week.

The bill limits county cooperation with the feds, making Westchester New York’s first “sanctuary county” — and seriously boosting the risks of crime for residents.

The good news? County Executive Rob Astorino vows to veto the bill, and lawmakers need 12 votes to override him. The IPA, he says, “puts public safety at risk” — including for the very immigrants it claims to protect.

That fear is justified. Recall the horror stories of illegal immigrants shielded by “sanctuary cities” who go on to commit heinous crimes. In the city, Mayor de Blasio’s policies recently led to the release from Rikers Island of an admitted gang member sought by the feds.

No wonder Westchester public-safety boss George Longworth worries the bill would make “families and police officers less safe.”

As does the county Hispanic Law Enforcement Association: It “opens the doors for undocumented immigrants involved in criminal activity, such as the ruthless MS-13 gang, to migrate to Westchester and prey on other immigrants,” argues President Hector Lopez.

With Team Trump targeting MS-13’s heavy presence on Long Island, it’d be nuts to offer those thugs another nearby refuge.

Dedicated as it is to standing up for criminal defendants, the Westchester Legal Aid Society also sees problems. Executive Director Clare Degnan rejects the IPA “as drafted and passed,” based on its language and tone.

Plus, warns Astorino, the bill “puts Westchester at odds” with Washington, “creates rights not available to ordinary citizens” and endangers $13 million in federal funds by undermining cooperation with the feds.

County lawmakers may think they’ll score political points by seeming to champion illegal immigrants. In reality, their stunt is a slap at every Westchester resident.