Gov. Gavin Newsom vetoed legislation that would have allowed California universities and colleges to employ undocumented students without legal work permits.

The veto, made Sunday, is a blow to thousands of young people brought to the U.S. as children and often struggle to secure paid, on-campus jobs, internships and research opportunities. Assembly Bill 2586, authored by Assemblyman David Alvarez, D-San Diego, would have directed the University of California, California State University and California Community Colleges systems to employ these students.

The landmark legislation overwhelmingly passed the Legislature last month.

In his veto message, Newsom highlighted California’s history of expanding educational opportunities for undocumented students but warned of the legal risks of signing the bill.

“Given the gravity of the potential consequences of this bill, which include potential criminal and civil liability for state employees, it is critical that the courts address the legality of such a policy and the novel legal theory behind this legislation before proceeding,” Newsom said.

Newsom also suggested the UC seek “declaratory relief in court,” calling it an option to clarify the issue. UC officials have previously considered such a route, which would center around asking a federal court to rule on the legality of hiring undocumented students.

The UC had expressed concerns about the bill, saying students could be exposed to prosecution and deportation and the university could face fines, penalties or lose federal contracts. Earlier this year, UC leaders delayed considering a plan for one year that would employ undocumented students.

In an email statement, the UC committed to continue exploring options and supporting undocumented students who should have access to educational employment opportunities.

“This is a complicated situation, and we acknowledge the Governor’s basis for his veto in light of concerns that federal law would prohibit the university from hiring undocumented students, and that the implementation of this law could put our students, faculty, staff, and significant federal funding at risk,” the UC said.

Alvarez, in a statement, called Newsom’s veto a “profound disappointment” and vowed to keep advocating for the bill.