The Legal Aid Society is calling Mayor Eric Adams’ request to rewrite the city’s 40-year-old right-to-shelter law an attempt to “eviscerate its bedrock legal protections” that would force people to sleep in public and unsafe spaces.

In a letter to Judge Erika Edwards in Manhattan state Supreme Court, Legal Aid staff attorney Joshua Goldfein argued that in contrast to the mayor’s contention, the city has “both resources and alternatives that it should deploy to address the homelessness crisis in New York City.”

The letter, which was sent on May 25 and released by Legal Aid on Tuesday, is a preview of the opposing arguments that will likely arise should Adams proceed with his plan to challenge a 1981 court order requiring the city to provide shelter to anyone who requests it. It's the latest legal volley in a series of battles the city is waging to manage what the mayor calls a "humanitarian crisis" generated by the arrival of more and more migrants to the city each day.

“The Adams administration must not use temporary difficulties to justify the erasure of a law that has protected New Yorkers for decades from immeasurable harm and prevented our city from experiencing dangerous mass street homelessness,” read a statement by Adriene Holder, the chief attorney of Legal Aid’s civil practice.

New York City is the only major U.S. city that has such a rule.

Legal Aid, which represents the Coalition for the Homeless, has successfully fought various mayors over the years to uphold the right to shelter.

Adams has yet to file a motion that would trigger the legal battle. But in a letter last week, an attorney for his administration argued that the unprecedented migrant crisis has made providing shelter for everyone an impossible task and that an exception to the right to shelter rule should be made when the city lacks sufficient “resources and capacity.”

Because the original Callahan case was settled by a consent decree, the city must get the court’s permission before altering the right-to-shelter rules.

City officials have now counted more than 70,000 migrants as having arrived in the city over the last year. Roughly 45,000 are said to be currently in the city’s care.

In recent weeks, City Hall has stopped providing data on the exact count of migrants in the city's shelter system. But many have been staying in hotels and nine emergency shelter sites.

Goldfein said the city has been able to institute reforms to move more people out of shelter.

His letter pointed out that the city’s homeless shelter count has in fact declined in recent weeks. More than 1,000 beds are currently empty, according to a recent Gothamist report.

In a phone interview, Goldfein said it was unclear whether the city was diverting more migrants to emergency shelters and hotels. Either way, he said, the city was not providing that information.

But such data will inevitably come out should the matter go to court.

Fabien Levy, the mayor's press secretary, denied the city was seeking to end the right to shelter.

"Instead, we have asked the court for relief in response to a situation that could have never been contemplated four decades ago with tens of thousands of additional individuals coming through our intake system seeking shelter in a single year," he said in a statement.

This story has been updated with comment from the mayor's office.