A federal judge last week upheld the state’s Green Light law, which will enable undocumented immigrants to apply for driver’s licenses once it takes effect next month.

For immigrant advocacy groups, it was a major victory for a long-sought measure that had previously been approved in June and is sharply opposed by local government officials, including some county clerks, who have pledged to not comply with it.

“We are pleased that the court has ruled in favor of upholding the Driver’s License Access and Privacy Act, also known as the Green Light Law,” said Eddie Taveras, the immigration manager of the group FWD.us.

“This decision does not come as a surprise, as it follows the precedent set in other states, where similar measures have also passed legal muster,” he said.

The advocacy groups that have backed the legislation have pointed to other states that provide undocumented immigrants with some form of identification. But the issue has long been controversial over the last decade following a botched and later scuttled proposal by then-Governor Eliot Spitzer in 2007.

The issue has since been a third rail of New York politics. The measure was approved in June after Democrats gained control of the state Senate for the first time in a decade.

The law was opposed by county clerks who administer local motor vehicle offices. The suit rejected on Friday was filed by Erie County Clerk Mickey Kearns. There are at least two other challenges to the law by county clerks in Niagara and Rensselaer counties.

“How much of Erie County’s hard-earned taxpayer dollars was wasted on Mickey Kearns’ useless political stunt?” said New York Immigration Coalition Executive Director Steven Choi.

“As we’ve said all along, we’re not surprised that a federal judge put Erie County Clerk’s Mickey Kearns’ politically-motivated lawsuit stunt where it belongs — in the trash.”

Kearns told reporters on Friday the judge in the case essentially punted on it, declining to rule on the merits of the law itself.