This summer marks the 25th anniversary of the Rostock riots - the most disturbing resurgence of anti-immigrant violence in Germany since the rise of Nazism.

In the quarter-century since, many foreigners arriving in Germany have experienced the warmest of welcomes - but a few have experienced chilling acts of hatred. This series explores how a small minority of ultra-xenophobic Germans tarnished their nation's reputation as a haven for the world's displaced masses. These stories are primarily told through the experiences of immigrants and asylum seekers who survived xenophobic harassment or attacks.

Their stories are the exception to the norm: incidents of violent xenophobia are rare in Germany compared with in other countries. Indeed, Germany has welcomed more asylum seekers in recent years than any other European nation - the United Kingdom, France, Poland, Austria, Hungary, and many more than the far more populous United States. W hen faced with the largest exodus of people since World War II, none of these nations welcomed refugees as unconditionally as Germany did. It's precisely because of this reputation that Al Jazeera is taking a hard look at what happens when that welcome culture goes awry.

This is the sixth story in a seven-part series.

Salzhemmendorf, Germany - Late one summer night in this quiet village, a Molotov cocktail came flying through the window of the apartment where a Zimbabwean refugee and her three young children lived.

In the apartment next door, an asylum seeker from Pakistan who calls himself Mr Khan heard nothing. He was sitting at his computer with his headphones on, watching videos on the internet with news from Karachi. He and his family had fled Pakistan for Europe in 2012 after some of his colleagues - lawyers who were Shia Muslim - had been murdered by Sunni Islamic extremists. (Dozens of religious-minority lawyers have been targeted and killed in Pakistan in recent years.)

Using fake passports, the family flew to Belgium, but their asylum application was rejected. So they decided to try their luck in Germany. Khan had seen on the news that tens of thousands of refugees were making their way there, and volunteers had already begun helping asylum seekers to find shelter and food.

"Maybe Germans see the pain of the refugee system in a way that other countries don't," he thought.

Khan - who asked that his first name be withheld out of fear that media attention could make him a further target in Pakistan - arrived with his family in Cologne on January 8, 2015, the day after the attack on the Charlie Hebdo office in Paris made international news. Germany's refugee agency assigned the Khan family to the house in Salzhemmendorf, in north-central Germany, while they awaited a decision.

Molotov cocktail

At first, Khan was relieved to live in a village of fewer than 10,000 people.

"I myself belong to Karachi. It's a cosmopolitan city, the population is very big," said Khan of the city he fled. "So when I saw all this area was cultivated [for farming], I thought, we are safer here."

The day before the attack, Khan, his wife and two children had spent all day travelling to and from the city of Hanover to renew their asylum seeker ID cards. When they returned after dark they were exhausted.

"My children and wife also, they were sleeping, but I was awake," Khan recalled. He stayed up watching the news from Pakistan online, as he did every night, waiting for signs that might indicate it was safe to return.

When he heard a loud banging on his apartment door, he opened it to find a police officer, who ushered him and his family outside. The building smelled of smoke, and Khan surveyed the wreckage: The Molotov cocktail had destroyed the bedroom it was thrown into. It was the room in which the woman's 11-year-old son usually slept on a mattress on the floor. By chance, he was sleeping in his mother's room that night, which may have saved his life.

Outside, "I heard the sound of the fire brigade," Khan said. "If they did not come, this whole building could have been finished."

On a rainy day last May, Al Jazeera returned with Khan to visit the scene of the attack. The building was still being used as a shelter for asylum seekers from around the globe.

Dark-haired and heavyset with a thick moustache, Khan pointed out the window through which the homemade bomb had been thrown. Upon entering the building, he encountered a Syrian family he knew. They were packing their things to move into a permanent apartment.

"They are in luck," Khan said. "The German nation let them stay."

They were Syrians, a category of people for whom Germany's government has carved out exceptions to European asylum law to allow them to stay. Khan and his family, in contrast, were Pakistani. Unlike the millions of people fleeing the well-documented civil war in Syria, to remain in Germany Khan would have to prove that he as an individual too would face threats to his life were he deported back to Pakistan.

"Tomorrow, I don't know what will happen," Khan said. "Maybe Germany will say, 'Out!'"

In fact, it would, revealing a major qualification to Germany's label as the refugee welcome capital of Europe: Not everyone would be allowed to stay.

Read a related article about German chancellor Angela Merkel's trip to Egypt and Tunisia in effort to help reduce irregular migration into the EU in a policy known as 'Control'

'Garage Swastika'

"Salzhhemmendorf is a village, very beautiful," Lukas Theune, Khan's pro bono lawyer, told Al Jazeera one morning in his Berlin office. "Typical German, old wooden construction that you can see from the outside."

Contrary to the stereotype that anti-immigrant sentiment manifests primarily in the former East Germany, "this was West Germany," Theune said.

The day after the attack, as dozens of Germans demonstrated outside the scene of the crime in solidarity with the victims and in opposition to right-wing extremism, the prime minister of Lower Saxony called the act an "attempted murder".

But the town's mayor downplayed the attack's xenophobic nature.

"'We don't have any Nazis in this town," Theune recalled him saying.

The mayor was wrong. The perpetrators turned out to be Dennis Lemke, Sascha Dohme, and Saskia Burger, all longtime Salzhhemmendorf residents. They were quickly identified by a witness who was smoking on a nearby balcony when he saw the attack unfold.

The three were arrested and confessed to preparing a homemade bomb, then driving to the refugees' apartment and throwing it in.

Dohme, it turned out, was a volunteer firefighter for the town. After participating in the attack and fleeing the scene, he was called on to help extinguish the flames.

According to the prosecutor's investigation, before the attack, the trio had exchanged messages in a chat group called Garage Swastika. Dohme referred to himself as "The new Adolf". Burger reportedly bragged that she'd taught her two-year-old son how to say "Heil Hitler!" Lemke had SS symbols from Nazi times tattooed on his left breast and right forearm.

Read a related article about the rise of Germany's anti-refugee right

Prosecuting hate crimes

The judge concluded that the attack was xenophobic in nature, which allowed him to sentence the trio more strictly. Each received between four to eight years in prison.

It was a rare victory for German authorities, who are struggling to prevent and prosecute thousands of arsons and other attacks on asylum-seeker housing complexes across Germany. In most cases, the perpetrators are never found.

Khan was invited to attend the trial. A lawyer himself, he was struck by the informal, approachable conduct of the judge.

"I was very surprised when in the break the judge was standing in front of me in a queue for coffee. In my country, the judge, you have to salute!" Khan said. "Their level is so high; they would never shake your hand."

Of the Germans on trial for attacking his apartment building, Khan said: "It's their right. Yes, they can hate. This is normal. Discrimination is by default in the human being. Racism - black, white."

The difference, he said, is how a government chooses to react to that racism when it turns violent. He said if Pakistani police had responded this decisively to the dozens of murders of fellow Shia lawyers back home, he would never have had to flee in the first place.

"Protection?" Khan asks. "In Pakistan there was no protection."

Read more about mistrust of Pakistan's justice system in this related article about the forced disappearances of activists

Defining persecution

One afternoon inside the Hanover apartment to which his family was relocated after the attack, Khan switched the TV channel from the German language cartoons his two children were watching to a Pakistani news broadcast. It's crucial to keep up to date on what is happening, Khan said, in case one day they are deported back there. He watched a segment about a US drone strike which killed a Taliban leader in northern Pakistan.

His wife, who has pronounced dimples and a youthful appearance, entered the living room with a large pot of fragrant biriyani. Khan began dishing it out. "To buy masala, there is just one shop here," Khan said. "Very far."

After eating, Khan pulled out a thick folder of documents he'd collected to prove to German authorities that his life would be in danger if he were deported back to Pakistan.

He took out a copy of a letter written in Urdu that was addressed to an attorney he knew in Karachi. "They write in this letter directly: We will kill you. Not only that, we will kill your whole family," Khan explained. "All my colleagues received these type of letters." Some of them were later killed, including the recipient of this particular letter.

In his folder was a BBC article: "Karachi shooting: Gunmen kill three Shia lawyers," the headline read. "This is what gave me the motivation to escape from my country," Khan said.

"They stopped them and shot them in the street," said Khan of the attackers, who fled the scene on motorcycles. If it could happen to them, he reasoned, it could happen to him too. "After this killing, we decided to run."

Khan speaks eloquently, but urgently. Often, when a Shia lawyer is killed in Pakistan, he sends WhatsApp messages with grisly videos or photos of the carnage. Late last year, he wrote to say that his family's application for asylum - the right to remain in Germany as legal residents - had been rejected. Pending an appeal, they would be deported back to Pakistan.

A successful appeal was unlikely. For a refugee from Pakistan, "It's hard to meet the definition of persecution," Theune said. "It's a military dictatorship, but it's also a democracy."

Watch this related video from Al Jazeera's Witness program of one family's journey from war-torn Syria to a new life in Germany (24:59)

Deportation

This spring, Khan's family was informed that their appeal had been rejected. They would have to leave Germany before the end of May.

"My children now speak Deutsch [German]," Khan said during a phone call after he'd received the news. "They don't want to go back. My wife, she was weeping." Years ago, her father had been murdered in Pakistan, and recently her brother had been attacked, leaving him with a major spinal cord injury and partially paralysed.

"Europe, they talk about human rights. But nobody helps us," Khan said. "We don't believe in human rights. All this is rubbish. It's only on paper, that's all. Rubbish."

Khan's initial admiration for the way Germany's legal system swiftly identified and convicted the people who had firebombed his apartment building gave way to a feeling of discrimination.

"We were together in that house that burned in Salzhemmendorf [with] an Arab family from Syria," Khan said. For the Syrian family, Germany suspended the European Dublin Regulation, which states that refugees can only apply for asylum in the EU country in which they first step foot. "But for me, because we are Pakistani family, they say no."

His family is not alone. Last year, 15,528 Pakistanis applied for asylum in Germany. In the first four months of this year, Germany's Federal Office for Migration and Refugees granted asylum to just 18 of them. Just 280 were allowed to remain in Germany in some capacity; 8,557 were rejected and ordered to leave.

By contrast, during that same period, 47,628 asylum seekers from Syria were allowed to stay. Only 62 were rejected. In the first four months of 2017, Germany granted asylum to just 1,161 of all asylum seekers, another 131,057 were allowed to stay temporarily, and 106,232 were rejected.

Khan and his family found themselves among a rising population of unsuccessful asylum seekers in Germany at risk of deportation. Last year, Germany deported more than 25,000 and as many as 80,000 rejected asylum seekers. A classified study by McKinsey obtained by Der Spiegel estimated that German authorities could legally deport as many as 195,000 refugees in 2017.

Last month, in compliance with the order given to them to leave the country following the rejection of their asylum status, Khan and his family boarded a flight home for Karachi.

Khan's story illustrates what many say is a major flaw in the global refugee resettlement system: the arbitrariness of it all. To people like Khan, it exposes Germany's so-called welcome culture - the narrative that Germany opened its doors indiscriminately to the world's displaced masses - as a myth. True, the vast majority of refugees from Syria and Iraq, and many from Afghanistan, were welcome here, at least for now. But hundreds of thousands of others were not.

This reporting was made possible by a McCloy Fellowship from the American Council on Germany.