Immigration officials in the industrial city of Duisburg pulled Bivsi Rana out of the classroom in late May and deported her to Nepal with her parents on the same day.

The deportation of the German-born Nepalese girl and her parents caused outrage in the community, which lobbied the mayor and local government to take action.

After protests and bureaucratic wrangling, two months later Bivsi has received an "exchange student visa" that also enables her parents to return to Germany. It also allows Bivsi to apply for follow-up visas to pursue further studies.

Read: Things to know about deportations in Germany

"This is a unique case that cannot be generalized," said North Rhine-Westphalia (NRW) state Integration Minister Joachim Stamp. "The right of the child stood in the foreground in this decision. Bivsi was born in Germany and grew up here – she is de facto a German kid."

Legal but unfair deportation

Bivsi's parents came to Germany in 1998, but their asylum applications were repeatedly denied despite multiple appeals. Their deportation was therefore completely legal.

Duisburg Mayor Sören Link speaks to a rally of students, parents and teachers from Steinbart-Gymnasium in June demanding Bivsi be allowed to return to school.

Despite the legality, students and representatives of the school, Duisburg Mayor Soren Link, the state integration minister and the petition committee of NRW all pressed the German Foreign Ministry to address the injustice.

Mayor Link said that he was particularly impacted by the students at the school, who organized protests and lobbied to have their school friend return.

Read: The dark side of Germany's deportation policy

He said that the federal government must pass laws that in the future do not force local governments to deport families such as the Ranas.

For Stamp, the state's new Free Democrats integration minister in the coalition with the Christian Democrats, the case shows the need to accept those that integrate well into Germany.

"The goal must be to provide a reliable prospect of staying in Germany for those that are well-integrated, but therefore also the consistent deportation of those who refuse to integrate or are criminals," he said.

cw/kl (AFP, dpa, epd, KNA)