Rayfran Pereira, who comes from Brazil's poorest state of Maranhao, where half the people are illiterate, beat the odds.

At 25, seven years after leaving home, working long hours at low-paying jobs and studying in his spare time, he has passed a demanding test to attend an elite university in South America's largest city and become an eye doctor.

A product of inferior public elementary and high schools, dark-skinned Pereira stands out among his medical school peers. Ninety percent of them grew up with domestic servants, went to fancy private high schools and never had to work.

To narrow gaping social inequalities, Brazil's government is encouraging public universities, which are free and regarded as the best in the country, to adopt racial quotas. Yet a long tradition of mixed-race marriage in Brazil could make implementing them difficult.

"I have friends who are poor and white and, if you saw my sister, you wouldn't believe it -- she is white with green eyes," Pereira said. Like many Brazilians, he has one white parent and one black parent, often with indigenous ancestors.

Seventeen universities, including Pereira's, used quotas this year as Brazil, the country with the largest black population outside Africa, embarks on a plan to define social benefits by race for the first time since banning slavery in 1888.

As in South Africa and the United States, controversy surrounds racial quotas. Brazil's experiment, however, might prove more complex. Its system depends mainly on how students define their race.

Many Brazilians have fluid concepts of racial identity. Some don't consider themselves white, black or mixed, but simply "Brazilian" -- a catchall term that can also include those of Indian, Japanese or Arab heritage. Using the quotas would force many people to choose a racial identity.

Pereira, who has misgivings about quotas, passed the entrance exam at the Federal University of Sao Paulo in two categories. In one, he competed against all students for one of 20 spots. In the other, he competed against blacks and Indians for one of two extra quota spots.

The dean of students at the university, Edmund Chada Baracat, said the system at his school, implemented for the first time this year, isn't perfect because it doesn't address the needs of poor white students.

"This is something we want to address with the next incoming class," Baracat said. "We'd also like to get more funding to make sure poorer kids get aid to pay their rent and food so they don't end up quitting or working outside school."

The quota systems developed by each of the 17 universities vary widely. At the State University of Campinas, known as Unicamp, students who graduated from public schools are given 30 extra points on their entry exams, while blacks or Indians are given 10, allowing some to get up to 40 points out of a total of 800.

A law pending in Congress would force dozens of other public universities to adopt quotas and impose a single nationwide system.

First, it would reserve half of all university spots for graduates of public high schools. Then it would proportionally allocate those seats according to each state's racial breakdown in the latest census.

The government has tried to address the needs of poor whites who went to public high school by including them in the quotas introduced in the last couple of years. So, in Bahia state, which has a large African Brazilian population, 73 percent of the reserved seats would go to students with African ancestors, 25 percent to poor whites and the rest to Indians.

African Brazilians who went to private high schools would not be eligible for quotas. Education officials say the system tries to avoid a common criticism made of the U.S. system that it sometimes benefits rich minorities instead of poor ones.

Brazilians tend to support setting aside spots for public high school graduates, though many are less sure about introducing racial quotas and worry that they might undermine entry based on merit alone.

Constitutional law scholars are concerned about court cases in Brazil's fractured judiciary challenging individuals' subjective definition of race, especially because a student could identify himself as black even if his peers consider him white.

Lawyers also worry that the policy could violate Brazil's constitution, which outlaws any kind of discrimination.

About 10 court cases have been filed to protest the quotas, but it could take years for the Supreme Court to rule on the issue.