BERLIN (Reuters) - A decade ago, the Ruetli school in Berlin's Neukoelln district became a symbol of all that was wrong with Germany's integration of immigrants.
Its teachers begged city officials to shut it down because of violence. Hooded students were filmed pelting police and reporters gathered at the school's entrance with cobblestones.
Today, Ruetli is transformed and the scenes from 2006 a distant memory. Some 33 million euros ($35 million) in public money have been pumped into the school over the past few years and the widow of former German president Johannes Rau is a patron.
Violence is down sharply and a gleaming new event hall houses art exhibitions and a state-of-the-art gymnasium.
For wealthy Germany, which faces a mammoth challenge to integrate and educate hundreds of thousands of refugees - many of them fleeing war in Syria, Afghanistan and Iraq - the radical remake of Ruetli is an example of what is possible if politicians embrace the task with commitment and resources.
Conversely, the Ruetli of ten years ago is a reminder of how integration can veer off course when the authorities don't get behind it.
"What we've learned is that integration needs to be shaped," said Cordula Heckmann, principal of the Ruetli school and a teacher there since 2001. "The years of experience we've had with people coming to us shows that this process cannot be left to its own devices."
Ruetli is located in a heavily Arab and Turkish neighborhood where 52 percent of the inhabitants have a migrant background and 71 percent depend on welfare benefits.
Germany's post-war experience with immigration was shaped by the arrival of thousands of "Gastarbeiter", or guest workers, from southern Europe and Turkey in the 1960s and 70s.
Despite the label, few returned to their home countries and today about 20 percent of all Germans have a migrant background. The numbers are much higher among young people.
In past decades, Germany was criticized for neglecting the integration challenge. The influx of up to a million refugees this year alone means that is no longer an option.
Sabine Achour, a professor of political science at Berlin's Free University, says successful integration depends on robust education and language training from an early age.
Over the past six years, Germany has invested 4 billion euros ($4.3 billion) to expand the number of full-day schools - German schools generally close at noon - in part to reduce the gap between students with migrant and non-migrant backgrounds.
But Germany's federal system of education, in which policy is determined at the state level, has led to a mish-mash of integration agendas and differences in the amount of resources devoted to the task.
"If we sell Ruetli as a model of success, we also need to be fair and say that this success went hand in hand with significant investments," said Tom Erdmann, the head of Berlin's teachers' union.
Back in March 2006, Ruetli was labeled a "terror school" by the German press when its teachers wrote to authorities urging it be dissolved.
They described in vivid detail the conditions under which they were forced to work. Students were kicking in doors, lighting firecrackers, hurling projectiles at teachers and tearing down pictures in the hallway, leaving educators "helpless" and "on the brink of exhaustion," the letter said.
Many teachers were also critical of the German education system, which determines at around the age of 10 whether students will pursue an academic track, the "Gymnasium", or be relegated to "Hauptschule", with dimmer professional prospects.
The ratio of students from German families who attend Gymnasium is twice as high as those from migrant families. Of those students who leave school without a degree, 62 percent have migrant background.
With the backing of a majority of her teachers, Heckmann reinvented Ruetli as a "Gemeinschaftsschule", or common school, where students of all levels remain together from kindergarten through high school graduation.
The new Ruetli is a full-day school, allowing students to join afternoon clubs, learn an instrument and improve language skills, including their parents' Arabic and Turkish.
It has also started offering advisory services to parents. Teachers now make regular home visits.
"Particularly in Germany, educational success depends heavily on parental support and children who don't have that backing are often left behind," said Thomas Liebig, expert on international migration at the OECD.
Siyar Daoud, 20, a pupil who came to Ruetli two years ago, says his parents, who were part of the Yazidi-Kurdish community in Syria before fleeing to Germany in 1999, would have benefited from more support when they first arrived.
"They were pretty much left to themselves," he said. "I think parents should be included much more and forced to learn the German language. It's good if the school helps in that."
Of the 848 students at Ruetli, 82 percent have a migrant background. But as gentrification has spread to Neukoelln, German families have begun sending their children to Ruetli, attracted by its innovative approach.
Still, some experts question whether the Ruetli success story can be replicated across the country, in part because the turnaround has depended on vast amounts of funding.
Sabine Achour of Berlin's Free University says German authorities may prefer to spend their money on measures to counter Islamic extremism, rather than on integrated schooling, which would be a more effective use of funds.
Last year, about 30 percent of all asylum seekers entering Germany were below the age of 18. The GEW teachers union estimates that 300,000 people of school age and 100,000 pre-schoolers will come to Germany over the next twelve months.
They estimate that 38,000 new educators will be required to teach these children. This will also cost money. Germany's Munich-based Ifo institute estimates that housing, feeding and educating refugees will cost the country over 21 billion euros ($23 billion) this year alone.
"I really hope that more desperate letters aren't necessary and that the politicians have learned that schools are the place where real integration takes place," said Ruetli principal Heckmann.
($1 = 0.9313 euros)
Editing by Noah Barkin and Giles Elgood