California's Supreme Court became the first in the country Monday to affirm the right of illegal immigrants to pay the same college tuition as state residents, rather than the higher out-of-state rate.

The ruling upholds a 2002 state law that lets students pay in-state tuition at public colleges and universities if they attended a California high school for at least three years before graduating.

Civil rights groups, university officials and undocumented students themselves applauded the ruling, which may impact thousands of people living in the United States illegally who apply to California colleges each year.

California's tuition law affects not only undocumented students, but also anyone who meets the high school criteria, such as boarding school students whose parents live in other states or graduate students who grew up in California but lost residency by going to college somewhere else.

Nine states have similar laws.

Of the 2,000 or so University of California students who benefit from the law, about 400 are undocumented, according to a UC survey. Other state universities say they don't track students' status.

"Through their hard work and perseverance, these students have earned the opportunity to attend UC," said Mark Yudof, UC's president. "Their accomplishments should not be disregarded or their futures jeopardized."

Nonresidents sue

In 2005, 42 people who live outside California sued UC, arguing that the state's tuition law gave illegal residents an unfair advantage over legal U.S. residents when applying to college. Federal law prohibits such advantages for undocumented students "on the basis of residence within a state."

But Monday's ruling said the California law is not based on residence, but on such factors as how many years a student attended high school.

"If Congress had intended to prohibit states entirely from making unlawful aliens eligible for in-state tuition, it could easily have done so," the court ruled.

Attorney Kris Kobach, who represents the plaintiffs, called the ruling a "very weak opinion." He said he will ask the U.S. Supreme Court to review the case.

Kobach, recently elected Kansas secretary of state, co-wrote Arizona's immigration law requiring police to question anyone they suspect of living in the country illegally. He said California's taxpayers lose millions of dollars each year because the state doesn't require undocumented students to pay the out-of-state rate.

But UC Berkeley sophomore Uriel Rivera, who entered the United States illegally at age 14, said taxpayers lose nothing because students like him have enough trouble paying the in-state rate.

Difference in tuition

At UC, state residents pay $11,300 in tuition a year; nonresidents pay $34,000. State and federal law prohibit illegal residents from receiving public grants or scholarships.

So Rivera and other undocumented students scramble for private scholarships. He wants to become a history teacher.

Today, however, Rivera is so far behind on tuition that the campus library won't even let him take out books.

Still, he said, he feels "happiness and relief" at the ruling. Without the tuition law, he said, "our chances of getting a college education would be nonexistent."

The case is Martinez vs. Regents of the University of California. The ruling can be found at sfg.ly/arNGH3.