The Supreme Court on Monday is set to wade into the highly charged gun control debate for the first time in nearly a decade, hearing a dispute over a New York City gun restriction that could have major implications for gun rights nationwide.

The court has steadfastly declined to take up any gun rights cases since ruling in 2008's Washington, D.C. v. Heller that the Second Amendment provides a right to keep a handgun at home for self-defense and later clarifying in 2010's McDonald v. Chicago that the right applies nationwide. Now the court's willingness to take the New York case — even though the law at issue was recently repealed — has gun rights supporters feeling optimistic that it could lead to a ruling about the right to bear arms outside the home.

Gun control advocates, in contrast, fear the court's new conservative majority may produce a decision that the National Rifle Association could use to fight against many of the 300 local gun restrictions enacted since the Sandy Hook school shooting in 2012.

"What's really on the line is our progress against gun violence and the future of life-saving gun safety laws," said Hannah Shearer of the Giffords Law Center to Prevent Gun Violence.

The ordinance in question said that residents with the proper permit could take a handgun outside the home to a city shooting range, provided it was unloaded in a locked container, but that the gun could not be taken beyond the city limits.

Three residents challenged the provision, saying that they wanted to take their firearms outside the city to gun ranges, shooting competitions and second homes. They argued that the law violated their Second Amendment rights and said transporting an unloaded gun in a locked container did not pose any significant safety risk. Two lower courts rejected their claims and upheld the law.

After the Supreme Court agreed to take up the case, the city repealed the ordinance. The New York state Legislature then passed a law prohibiting local governments in the state from enacting similar restrictions. The moves were intended to deprive the court of a vehicle for taking a new look at the reach of the Second Amendment.

New York urged the Supreme Court to dismiss the case, explaining there was nothing left for the challengers to fight. "Independently and together, the new statute and regulation give petitioners everything they have sought in this lawsuit," the city's lawyers told the court.

But the challengers, along with gun rights groups, urged the court to hear the case anyway.

New York's changes in the law "reflect the city's unwavering view that the ability to transport a licensed handgun is a matter of government-conferred privilege, rather than a constitutional right," wrote Paul Clement, a Washington lawyer representing the gun owners in a court filing. "The city has never abandoned its view that the right protected by the Second Amendment is a homebound right."

New York now specifies that anyone taking a gun to a shooting range cannot make any stops along the way, including to a gas station or coffee shop. And the city forbids taking a gun to a vacation rental house, Clement said.

In an unusually critical friend-of-court brief, Sen. Sheldon Whitehouse, D-R.I., said if the court agreed to hear the case, even after New York repealed the law, it would look like a partisan move.

"The Supreme Court is not well," Whitehouse said in August. "And the people know it. Perhaps particularly on the urgent issue of gun control, a nation desperately needs it to heal."

Senate Republicans responded to Whitehouse by calling the brief a threat.

"The implication is as plain as day: Dismiss this case, or we'll pack the court," they said.

The court will issue its decision by the end of June.