NEW YORK (PIX11) — New York City has reached its breaking point as it now cares for nearly 45,000 asylum seekers, Mayor Eric Adams said Wednesday.

Adams is asking a judge to let him potentially turn away migrants and homeless New Yorkers if necessary. The “right to shelter” law in New York City is more than 40 years old. It is a court ruling that basically says if you show up at a city intake center, you must get a bed.

“New York has done its share. Our shelter system is buckling. We are trying to prevent it from collapsing,” Adams said.

Adams’ legal team is asking a state judge to give his administration additional flexibility to deny shelter when the city “lacks the resources and capacity.”

Adams argues that this is happening now as New York City attempts to care for 94,000 people in need of shelter, including 44,700 asylum seekers. His administration said when the “right to shelter” policy was conceived, only a few thousand homeless people were in shelters, and courts could not have imagined this migrant crisis.

“It’s unfair to our city. It is taking away resources, and New York City should not be handling a national crisis,” Adams said. “The courts should decide. We are presenting our case in front of the court.”

Adams administration staff said New York City would only potentially turn away adults if necessary, but it wouldn’t turn away families with children.

However, the move to roll back any part of the “right to shelter” law has struck a nerve with advocates, especially City Councilwoman Diana Ayala, who has experienced homelessness herself.

“I get it. I get what having a roof over your head can mean,” Ayala said. “I know how hard it is to even walk through those doors. I cried for days when I walked in.”

“The right to shelter is a simple law that says no one should have to sleep in the streets, and what that’s doing is raising the bar on what it means to be housed, dignified, and what it means to be a compassionate city,” said Councilwoman Jennifer Gutierrez.

New York City Council members gathered together Wednesday pledging to pass a package of laws — without the support of the mayor — they believe will more quickly allow more people in shelters to get and use rental assistance vouchers. They said it will save the city millions of dollars and open up much-needed emergency shelter space for migrants.

“Whether you like it or not, whether you blink your eyes or not, these people are not going away,” said Councilwoman Julie Won. “The buses are not going to stop. The migrant crisis is not going to stop, and we need to make sure every New Yorker has a right to housing and opportunities in the way that it was allowed to me and all of the children of migrants that you see behind you.”

A spokesman for the mayor said he was willing to wave the 90-day voucher waiting rule for families with children and shelter.

The vote Thursday will set up a fight over a potential veto of these new housing voucher rules by the mayor.

City Council members expressed confidence they can override any veto with a supermajority.