“One problem with the prior regulation,” Justice Ginsburg said, was that “if you wanted to have a gun in your second home, you had to buy a second gun.”

“And what public safety or any other reasonable end is served by saying you have to have two guns instead of one — and one of those guns has to be maintained in a place that is often unoccupied and that, therefore, more vulnerable to theft?” she continued.

Paul D. Clement, a lawyer for the challengers in the case, New York State Rifle and Pistol Association v. City of New York, No. 18-280, said the restrictions imposed by the ordinance were at odds with the words of the Second Amendment.

“The Second Amendment protects rights to keep and bear arms,” he said. “That latter right makes clear that the Second Amendment protects rights that are not strictly limited to the premises.”

Mr. Clement’s efforts to keep the argument focused on whether the repealed law was constitutional mostly failed. He was instead peppered with questions about whether the case was moot.

In response, he questioned a requirement in the city’s replacement law that the transport of guns to permissible places be “continuous and uninterrupted.”

Mr. Clement said his clients were entitled to a clear judicial determination of whether they would violate the new law if they stopped for coffee or a bathroom break on their way to a shooting range or a second home. That theory seemed to satisfy Justice Gorsuch as a ground on which to say the case was not moot.