The California Supreme Court granted a law license Thursday to a man who has lived in the U.S. illegally for two decades. Advocates hope the ruling will open the door to millions of immigrants seeking to enter other professions such as medicine, nursing and accounting.

The unanimous decision means Sergio Garcia, who attended law school and passed the state bar exam while working in a grocery store and on farms, can practice law now.

It's the latest in a string of victories for people who are in the country without permission. Other successes included the creation of a path to citizenship for many young people and the granting of driver's licenses in some states.

"This is a bright new day in California history and bodes well for the future," the Coalition for Humane Immigrant Rights of Los Angeles said.

The court sided with state officials in the case. That pitted them against the White House over a 1996 federal law that bars people who are in the U.S. illegally from receiving professional licenses from government agencies or with the use of public money, unless state legislators vote otherwise.

Bill Hing, a law professor at the University of San Francisco, said the court made clear the only reason it granted Garcia's request is that California approved a law that specifically authorizes the state to give law licenses to immigrants who are here illegally. The law took effect this week.

Effects elsewhere unclear

It was unclear how many people would qualify to practice law under the ruling and whether it would influence other states. Legislatures and governors in more conservative states are likely to be less receptive to the idea.

Garcia, who plans to be a personal injury attorney in his hometown of Chico, said he hoped the decision would serve as a "beacon of hope" to others in the same situation.

Some questions remained unresolved, such as whether Garcia can appear in federal court or in other states. Federal law makes it illegal for law firms to hire him.

Chief Justice Tani Cantil-Sakauye, who wrote the opinion, said the new state law removed any barrier to Garcia's quest for a license. And no other federal statute "purports to preclude a state from granting a license to practice law to an undocumented immigrant," Cantil-Sakauye wrote.

Garcia, 36, arrived in the U.S. as a teenager to pick almonds with his father, who was a permanent legal resident.

His father filed a petition in 1994 seeking an immigration visa for his son. It was accepted in 1995, but because of a backlog of applications, Garcia never received it. He applied for citizenship in 1994.

Federal officials objected

The U.S. Department of Justice said Garcia was barred from receiving a law license because the court's budget comes from the public treasury, a violation of the federal mandate that no public money be used to grant licenses to people who are in the country without permission.

The Obama administration's position in the case came as a surprise to some, because the White House has shielded from deportation people who were brought to the U.S. illegally as children.

At a September hearing, a majority of the state Supreme Court justices appeared reluctant to grant Garcia the license under current state and federal law. They said they were prohibited from doing so unless the Legislature acted.

Garcia worked in the fields and at a grocery store before attending community college. He then became a paralegal, went to law school and passed the bar exam on his first try. His effort to get licensed was supported by state bar officials and California's attorney general.

Two similar cases are pending in Florida and New York, and the Obama administration has made it clear it will oppose bar entry to immigrants unless each state passes its own laws allowing the practice.

California Attorney General Kamala Harris applauded the ruling. Nick Pacilio, a spokesman for Harris, said California's success "has hinged on the hard work and self-sufficiency of immigrants like Sergio."

Thursday's decision is the latest example of changes in immigration policy happening at the state level while an effort to achieve a broad federal overhaul has stalled in the House.