SARISSKE MICHALANY, Slovakia -- Gazing out his window during morning recess on his first day at work, the principal of an elementary school here, Jaroslav Valastiak, was caught up short: all the children playing in the asphalt-covered yard were white, a strikingly monochromatic scene at a school where a majority of pupils are dark-skinned Roma.
The Roma children, he then discovered, had all been shepherded into a separate, Roma-only playground.
Lunchtime brought another shock. The school canteen served only white children, with Roma pupils left outside with bagged rations, instead of hot food. Classes were also divided, officially on the basis of academic aptitude, but in a manner that ended up grouping students along rigid ethnic lines.
"The segregation here was as obvious as fireworks," Mr. Valastiak said.
The 59-year-old principal has spent the past year trying to break down barriers, both physical and mental, in a painful struggle for integration that some here say echoes that of the United States more than a half-century ago.
"The situation in Slovakia now is exactly the same as it was in the United States," said Peter Pollak, a Roma member of Parliament and the government's plenipotentiary for Roma communities, who recently visited the United States to learn about its battles over segregated schooling and other entrenched barriers to equality.
In a continent faced with an economic crisis, soaring unemployment and bursts of nationalist populism, the elementary school here in eastern Slovakia is a microcosm of one of Europe's biggest challenges: how to keep old demons of ethnic scapegoating at bay and somehow bring its most disadvantaged and fastest growing minority into the mainstream.
Many Europeans associate Roma with crime, particularly well-organized gangs of young Roma pickpockets who prey on local residents and tourists alike in the Continent's wealthier cities.
Descendants of medieval migrants who arrived in Europe from India more than a millennium ago, Roma, also known as Gypsies, now account for around 10 percent of Slovakia's population and a substantial minority in Hungary, Romania, Bulgaria, Serbia, the Czech Republic and Macedonia. There are also Roma communities scattered across Western Europe.
In all these places, they outpace all other groups in unemployment, illiteracy and other indicators of deprivation and as targets for abuse and sometimes violent attack.
Only 20 percent of Roma men of working age in Slovakia have jobs -- compared with 65 percent in the general population -- and they die 15 years earlier than the national average, according to a World Bank report last year. Only 28 percent of Roma children even start the equivalent of high school, compared with the 94 percent of native Slovaks who graduate.
In terms of health, income and education, the report said, the "dire situation" of Slovakia's Roma "is more comparable with that of countries in sub-Saharan Africa than the European Union."
The struggle for desegregation in Sarisske Michalany and other towns and villages across wide stretches of Europe has galvanized a small but energetic band of civil rights activists and stirred angry opposition from defenders of the status quo.
"There is a lot of resistance to what we are trying to do," said Vlado Rafael, the director of EduRoma, a group that is now working with Mr. Valastiak, the school principal.
The most powerful lever working for desegregation in Slovakia has been the court system, which has been reinforced by antidiscrimination statutes adopted in the past decade to bring the code into conformity with European Union standards.
Inspired by the landmark 1954 United States Supreme Court decision in Brown v. Board of Education, which declared segregated schooling unconstitutional, Vanda Durbakova, a Slovak civil rights lawyer, filed a suit in 2010 against the Sarisske Michalany elementary school. Recently, she won a legal victory.
An appeals tribunal in the city of Presov ruled that the school had violated an antidiscrimination law by separating students. The three-judge panel rejected arguments that segregated teaching was driven by legitimate academic considerations, and ordered that classes be integrated by the start of the next school year.
Ms. Durbakova, a lawyer with the Center for Civil and Human Rights in Kosice, the main city in eastern Slovakia, said she chose the village not because it was a particularly egregious offender but for the opposite reason, because the "school is not exceptional."
The appeals court ruling, which came into force in February after the school decided against further appeal, "won't solve the problem," she said, but does give legal force to arguments long made by Roma activists that discrimination exists, is illegal and must be combated.
Leslie Hawke, an American, has worked for more than a decade in Romania helping to get Roma children into preschools. She worries that the focus on racial discrimination distracts attention from the abject poverty of many Roma and their alienation from modern mainstream norms, which she considers a more serious brake on integration.
Many Roma activists, Ms. Hawke said, "see everything through the prism of racism" and play down economic and social obstacles. "Tremendous racism" exists, she added, but "there are no Jim Crow laws to strike down."
Mr. Valastiak, the principal, said he welcomed the court's ruling but cautioned that integration ultimately depends mostly on narrowing the cultural gap. When he opened the school canteen to Roma students, for example, "we had to teach them how to use cutlery, and some had trouble digesting warm food."
He also abolished separate playgrounds and lifted a ban on Roma parents entering the school building. But, he acknowledged, integrating classes has only just started and has already created frictions, not only because white parents object but also because Roma children often do not want to leave their friends who remain in the segregated classes.
"I need to move slowly," he said. "I can't make a radical break."
Among the faculty, wariness of Roma runs strong. "These people are interested in only two things: money and sex," said Vladimir Savov, an English teacher. "They are lazy and don't want to learn."
Like other teachers, Mr. Savov now accepts that change is necessary, if only to satisfy the court, but he is deeply skeptical about abandoning segregated teaching. "Mixed classes are a good idea in principle, but the question is how will they work in real life," he said.
On paper at least, the school has never had separate classes for Roma but only special, remedial ones for slow learners, all of whom happened to be Roma. A 2009 study by the Roma Education Fund, a Hungary-based group, found that more than 85 percent of the students enrolled in special classes in Slovakian schools are Roma.
Mr. Valastiak said that not all Roma belong in remedial classes, but that many, particularly those who travel to his school from a garbage-strewn ghetto in the adjacent village of Ostrovany, do have trouble keeping up with their white schoolmates. Most Roma children from the ghetto, he said, start their schooling with no previous exposure to books, a poor grasp of Slovak and little or no discipline.
Of his school's 435 students, 270 are Roma, with 220 of these coming from the ghetto, which has no school.
Vincent Lesso, Sarisske Michalany's mayor, said he supported integration during recess and lunch, but not in the classroom. "Sudden integration is not an option," he said, and will only drive the white children to other schools. A handful of parents, angry at Mr. Valastiak's policies, have already sent their children to a school in another village that has no Roma families.
Mr. Pollak, the government's senior official for Roma affairs, agreed that the authorities needed to go slowly to curb the risk of "white flight." Officials also worry about extremist groups seizing on white frustrations to promote their overtly racist views.
"To think that there will soon be only integrated schools in Slovakia is naïve," he said.
White parents in Sarisske Michalany denounce the pressure for integration as the work of outsiders ignorant of local realities. "Why should my kid be forced to be part of an experiment that holds her back with Roma children?" said Lubos Bernat, head of the village school board and of an all-white parents association.
Monika Duzdova, one of two Roma teaching assistants hired by Mr. Valastiak to help the integration program, said she understood some of the concerns of white parents and added that the better-off Roma families were also alarmed by the flood of destitute children from the nearby ghetto.
The ghetto in Ostrovany is separated from the white neighborhood by a seven-foot concrete wall, erected in 2009 in response to a rash of robberies. It has not stopped thieving, but, said Peter Kaleja, a resident of the ghetto who works as a teaching assistant at the elementary school, has left Roma children even more alienated.
His biggest headache these days, Mr. Kaleja said, is not hostility from whites to integration, but from Roma children and their parents. "They have got used to separation," he said. "There is now a wall in their minds."
Miroslava Germanova contributed reporting from Bratislava, Slovakia.
Correction: May 10, 2013, Friday
This article has been revised to reflect the following correction: An earlier version of this article misstated the year of the Brown v. Board of Education decision. It was 1954, not 1953.
This article originally appeared in The New York Times.