New York's new concealed carry law, which sets requirements for applying for a license and where guns can be carried, survived an initial court challenge hours before it was set to take effect.

But a federal judge in a ruling also called the measure unconstitutional, and other legal challenges also loom to a measure approved in the wake of a U.S. Supreme Court ruling that overturned a century-old concealed carry law. 

U.S. District Court Judge Glenn Suddaby denied an injunction against the law taking effect in a Wednesday ruling, essentially determining the defendants in the case, which included the advocacy organization Gun Owners of America, lacked proper standing. 

The decision was initially hailed by state Attorney General Letitia James and Gov. Kathy Hochul. But Suddaby at the same time concluded New York's law -- which includes a range of stipulations for being able to receive a concealed carry license such as a determination of moral standing and character references — was in violation of the Second Amendment. 

"While pursuing a laudable goal of public safety, and in an attempt to curb an increase in mass shootings, the New York State Legislature generated an unconstitutional statute in the CCIA," he wrote, referring to the law's full name, the Concealed Carry Improvement Act. 

The ruling was critical of the law's "vague, subjective" criteria for the approval of a concealed carry permit. A more objective approach, Suddaby found, was through a mental health check, a background check and fingerprinting. 

The ruling also was critical of the law's requirement of a license applicant to turn over social media posts, calling it a violation of a person's Fifth Amendment right against self-incrimination. 

Suddaby wrote the plaintiffs in the case have "shown a strong likelihood of success on their claims challenging the open-ended discretion" requirement in the law. 

New York lawmakers and Hochul moved swiftly earlier this summer following the Supreme Court's decision that rejected the long-standing concealed-carry law.

The new law places limits on where guns can be carried, including mass transit, polling locations and other areas deemed to be sensitive. In New York City, officials on Wednesday touted gun-free zones like Times Square as necessary for public safety. 

The measure also lays down licensing and training requirements for a concealed carry permit. Defendants in the case had called those requirements too onerous and in conflict with the Supreme Court's decision.  

Despite the court's criticism of the law, the measure is in effect starting Thursday. 

"It is a just and right decision, and our smart, sensible gun laws will go into effect as planned tomorrow on Sept. 1 to keep New Yorkers safe," Hochul said in a statement on Wednesday evening. 

Still, more challenges are expected to the law in New York. James in a statement signaled she will continue to defend it in court. 

“As gun violence continues to impact communities across the country, today’s decision is a victory in our efforts to protect New Yorkers," James said. "Responsible gun control measures save lives and any attempts by the gun lobby to tear down New York’s sensible gun control laws will be met with fierce defense of the law. We will continue to defend the constitutionality of our laws to protect all New Yorkers."

A rush of permit applications were filed in the days leading up to the law taking effect. New York lawmakers and Hochul earlier this year also agreed, in a separate package of measures, to increase the age to possess a semiautomatic rifle from 18 to 21 and expand the state's red flag provision, meant to keep guns away from those deemed to be a danger to themselves or others.