It was 2:30 a.m. on Valentine’s Day last year when a detective watching a live camera feed from a major Queens thoroughfare spotted a man in a minivan who appeared to be holding a gun.

The police said they had quickly arrested the man, Robert Homer, and found a loaded Glock pistol in his pocket. When they checked his criminal record, they saw that he had a sex trafficking conviction. That made him ineligible for a gun license under federal law. He was indicted and pleaded not guilty to a charge of being a felon in possession of a firearm.

The case is now in jeopardy after a federal judge in Brooklyn ruled on Feb. 5 that the police did not have probable cause to stop Mr. Homer. In the ruling, the judge, Nicholas G. Garaufis, cited a 2022 Supreme Court decision that found U.S. citizens have a broad right to carry concealed firearms, overturning longstanding New York regulations. The case involving Mr. Homer is the latest test of gun laws in the state, where officials continue to grapple with how to square a legacy of strong gun control with the 2022 ruling.

Just nine days after Judge Garaufis’s decision in Mr. Homer’s case, a defense lawyer in a different gun case cited the ruling in state court in Manhattan, saying he understood it to mean that having a gun did not provide probable cause for a stop. The judge in the state case, Abraham Clott, said he disagreed with the federal judge’s conclusion.

The Supreme Court decision — in New York State Rifle & Pistol Association v. Bruen — “has really upended America’s laws,” said Adam Winkler, a professor at U.C.L.A. Law. That it has come up in connection with Fourth Amendment questions about probable cause in the Homer case “just shows the profound impact that Bruen is having,” he added.

Mr. Homer’s lawyer cited the Bruen decision in July when she moved to suppress evidence in the case. The lawyer, Marissa Sherman of the Federal Defenders of New York, argued that the police had not had probable cause to believe a crime was being committed when they searched Mr. Homer and found the gun.