BUFFALO, N.Y. — New York State won a major victory in federal court Friday over its Green Light Law, which would allow for undocumented immigrants to receive driver's licenses.

Erie County Clerk Mickey Kearns filed the lawsuit against the state and asked for a preliminary injunction to keep the law from going into effect next month.

U.S. District Judge Elizabeth Wolford granted the state's motion to dismiss the lawsuit, saying Kearns did not have the legal ability to bring such a case, either as an individual or in his official capacity as clerk.

"Because (Kearns) has failed to establish standing to challenge the Green Light Law, the Court is left with no choice but to dismiss (the) lawsuit," Judge Wolford ruled.

New York State Attorney General Letitia James reacted on Twitter.

"The law aims to make our roads safer and our economy stronger," James said. "We will continue to defend it."

Erie County Executive Mark Poloncarz also weighed in, issuing a statement that read, in part:

"Clerk Kearns, like every other elected official in our county, has sworn to uphold the laws of the United States and the State of New York. We do not get to choose whether we will enforce a law, and only a court can declare a law unconstitutional. Until such time as a law is determined to be unconstitutional we must enforce all laws. Otherwise we cease to be representative democracy."

RELATED: Judge reserves decision in case challenging state's Green Light Law

RELATED: Niagara County to file lawsuit challenging 'Green Light' law

RELATED: Sen. Jacobs introduces legislation to revoke Green Light Law