A federal court on Wednesday rejected a legal challenge to a New York law that is meant to make it easier to bring lawsuits against gun manufacturers, a victory for Democratic legislators who had championed the civil liability law.

The decision came a day after a mass shooting at an elementary school in Texas that left 19 children and two teachers dead, and 10 days after a mass shooting in Buffalo in which 10 people at a supermarket were murdered.

The lawsuit challenged New York's 2021 public nuisance law, which restored the ability of state and local governments to bring civil liability actions against firearm makers and their sellers for bad conduct. The measure was meant to address a 2005 federal law that was meant to give gun manufacturers immunity in similar cases.

"As we mourn the deaths of 19 innocent children lost to gun violence in Uvalde and the countless more in Buffalo and across America every day, this is a moment of light and hope. New York is proud to defend the right to impose reasonable gun restrictions that protect all of us," said New York Attorney General Letitia James. "As public officials, we were elected to solve problems and address the needs of the people. Prayers alone will no longer do, and cowardliness is not part of the job description. New York will always lead, and I urge others with a backbone to follow.”

Lawmakers who backed the original law last year also celebrated the outcome of the case.

"These have been a dark two weeks. Black people slain while shopping in Buffalo, a commuter shot dead on the train we take every week in Brooklyn, and children mercilessly massacred in Texas,” said Sen. Zellnor Myrie, who sponsored the bill with Assemblywoman Pat Fahy. “We've needed some good news in the fight to end gun violence and the court's decision today is just that."

New York officials are closely watching the outcome of a Supreme Court case in the coming weeks that could overturn the state's strict conceal carry provision. Gov. Kathy Hochul on Wednesday said she would bring lawmakers back to Albany for a special session to address the ruling if the law is overturned.

The Democratic-controlled Legislature next week is expected to approve a package of gun control laws, including measures meant to tighten New York's red flag law that is meant to keep guns away from people deemed to be a danger. Hochul has also proposed raising the age of when a person can purchase an AR-15-style firearm from 18 to 21.