Mayor Eric Adams’ decision to challenge New York City’s unique “right to shelter” rule isn’t the first time a sitting mayor has taken aim at the decades-old measure requiring the city to provide shelter to anyone in need.

Republican Mayors Michael Bloomberg and Rudy Giuliani before tried to end or erode measures that guarantee a bed in a homeless shelter. Both failed. And Mayor Bill de Blasio, a Democrat, quietly tightened eligibility for families with children.

Adams is now hoping a judge will determine that New York City can no longer sustain a right that exists nowhere else in the country, even as he touts the five boroughs’ superiority.

Here’s what you need to know:

Why is Adams doing this?

The mayor’s push comes as the city’s shelter population has soared past previous highs in recent months, with many New Yorkers unable to afford record-high rents and tens of thousands of newly arrived migrants entering the five boroughs in need of a place to stay.

Adams has repeatedly said the city’s shelter system, which was already strained from a deepening affordable housing shortage, can’t handle more people.

“Given that we’re unable to provide care for an unlimited number of people and are already overextended, it is in the best interest of everyone, including those seeking to come to the United States, to be upfront that New York City cannot single-handedly provide care to everyone crossing our border,” Adams said in a statement Tuesday.

In essence, Adams wants permission to suspend the right to shelter rules if the city can’t afford to house people, or doesn’t have the “capacity” to do so — an ambiguous determination with potentially lasting consequences.

He’s in for a fight.

What’s at stake?

New York City’s right-to-shelter rules have allowed the five boroughs to avoid the mass public homeless encampments evident in other cities, especially on the West Coast.

Already policymakers, shelter providers, homeless rights advocates and people who have experienced homelessness are lining up to defend the country’s only rules guaranteeing a bed for anyone in need.

Steve Banks, the former commissioner of the Department of Social Services under de Blasio, said eroding the right to shelter would lead to more people staying in public spaces.

“It is hard to see how asking a court to suspend the right to shelter that is secured by the New York state constitution is a winning strategy because there will be far more people sleeping on the streets if the city’s request is granted, and that is in no one’s interest,” said Banks, who previously served as head of Legal Aid and successfully sued to enact a right to shelter for children, a 25-year-long battle that started in 1983.

While the shelter system has faced relentless scrutiny over unsafe conditions, minimal supports and prolonged stays, the city’s rule at the very least guarantees a place to stay, said Milton Perez, an organizer with the group VOCAL-NY who experienced homelessness and lived in shelters

“It would be a terrible thing to see, whatever little protections we have weakened more so,” Perez said. “People are going to fight this tooth and nail.”

So what exactly is the ‘right to shelter?’

Back in 1979, a young lawyer named Robert Hayes sued the city and state on behalf of homeless men in New York City, with a man named Robert Callahan as lead plaintiff.

Hayes argued that a clause in the state Constitution stating that “the aid, care and support of the needy are public concerns and shall be provided by the state and by such of its subdivisions” guarantees that all men without housing have the right to a bed in an indoor shelter.

Later that year, a state judge agreed, siding with Callahan and Hayes, co-founder of the Coalition for the Homeless.

After two years of negotiations, then-Mayor Ed Koch agreed to the right-to-shelter premise and entered into a consent decree that allowed the Coalition for the Homeless to oversee the city’s shelter system and implementation of the rule. Callahan, however, died before the city agreed to the consent decree.

Over time, attorneys representing people experiencing homelessness brought new legal challenges resulting in the right to shelter for women and for families with children, along with new measures to improve conditions and prevent kids from sleeping in large group settings.

Reached by phone Tuesday evening, Hayes lambasted Adams for trying to chip away at the measure.

“I think it’s shameful. I think it’s cowardly,” Hayes said.

“There will be at least two generations of judges who have worked on these courts who would roll in their graves if the court ceded to the mayor’s requests,” he added.

Has anyone tried limiting the right to shelter before?

Yes. Trying to erode the right to shelter is somewhat of a tradition among mayors.

Both Giuliani and Bloomberg tried to restrict who could gain entry to shelters and limit how long they could stay.

Giuliani pledged to cap shelter stays and abolish the right to shelter on the campaign trail in 1993. Bloomberg tried to make single adults prove their eligibility for shelter in 2011.

Bloomberg continued to complain about the right to shelter throughout his tenure, infamously grousing that “you can arrive in your private jet at Kennedy Airport, take a private limousine and go straight to the shelter system, walk in the door and we’ve got to give you shelter.”

(It’s unlikely anyone has ever done that.)

Under de Blasio, the city tightened shelter eligibility for families with children. After checking into the sole family intake office in the Bronx, families still have to prove they have nowhere else to go within 10 days or risk losing their shelter beds.

During de Blasio’s tenure, the number of shelter rejections surged and many families were forced to reapply numerous times to remain in shelters, traveling from all across the five boroughs to the intake center where they had to physically be present with their children to plead their case.

What happens next?

Adams’ request to the court sets off a potentially lengthy legal process.

He asked the judge for permission to file a motion to amend part of the Callahan ruling with a new paragraph limiting “the obligations to provide shelter to both homeless adults and to adult families” when the city’s “Department of Homeless Services lacks the resources and capacity to establish and maintain sufficient shelter sites, staffing, and security to provide safe and appropriate shelter.”

Adams and other city officials contend that they do not actually want to eliminate the right to shelter for adults.

“We are in no way seeking to end the right to shelter,” said Deputy Mayor Anne Williams-Isom at a press briefing on Wednesday.

Instead, she said, they are seeking “clarity” from a judge “given that the city is unable to provide care for an unlimited number of people and is already overextended.”

More than 80,000 people are staying in DHS shelters, according to the most recent daily census count, and thousands more are staying in facilities run by other agencies.

But the wording of the city’s proposal would not limit the suspension of the right to shelter to the current moment or crisis.

Adams’ chief counsel Brendan McGuire said Wednesday that getting their way means permanently limiting the right to shelter for adults.

“It is essential and necessary to revisit the Callahan requirements because the question is how is the future going to be any different than the past year,” McGuire said. “And there’s no reason to believe anyone is riding in with a solution with respect to the numbers.”

That marks a stark difference from McGuire’s comments last September, when he said: “We are not reassessing the right to shelter. We are reassessing the city’s practices that have developed around the right to shelter.”

The Coalition for the Homeless and the Legal Aid Society say they will fight any attempts to erode the right to shelter.

“The administration’s request to suspend the long-established state constitutional right that protects our clients from the elements is not who we are as a city. New Yorkers do not want to see anyone, including asylum-seekers, relegated to the streets,” the two groups said in a statement Tuesday night. “We will vigorously oppose any motion from this administration that seeks to undo these fundamental protections that have long defined our city.”

Additional reporting by Elizabeth Kim.