European countries must not rush to repatriate Afghan refugees to their increasingly insecure homeland or blame their community for isolated crimes such as recent deadly attacks in Germany and in France, the top U.N. refugee official said on Monday.

Two Afghans have been detained in Germany on suspicion of killing a 22-year-old German man, the public prosecutor’s office said on Sunday.

French police detained a man who wounded several people in a knife attack in central Paris on Sunday, police and judicial sources said on Monday. The attacker, who a police source said was from Afghanistan, stabbed tourists and passersby.

Filippo Grandi, United Nations High Commissioner for Refugees, said that sending Afghan refugees home was a “complex issue in Europe” — despite a spate of suicide bombs and attacks across Afghanistan, including by the Taliban and Islamic State.

“There is a lot of pressure for Afghans to return. Our advice is to carry out this process with great caution because conditions from the security point of view are deteriorating,” he told a news conference on return from Afghanistan.

Grandi, asked whether he feared any backlash against Afghan nationals in Europe, said: “If anybody who is either an asylum seeker or a refugee commits crimes, this person has to be excluded from the (asylum) process or from refugee status.”

UNHCR spokeswoman Melissa Fleming later clarified that such exclusion applies only when a serious crime has been committed before the asylum seeker enters a country, and is then taken into account during the asylum process, before the person is determined to be a refugee. Refugee status is retained when a refugee commits a crime in the asylum country, but that person is subject to prosecution.

Grandi said suspects must bear the full force of law, but voiced concern that an entire community could be blamed for the crimes of an individual, or the issue manipulated for political purposes.

“This is very dangerous, because asylum seekers and refugees in their overwhelming majority do not commit crimes, and are particularly vulnerable to discrimination.”

Pakistan and Iran together host some 2.5 million Afghan refugees, but only 12,000 returned home so far this year against 40,000-50,000 at this time in 2017, according to his agency.

Some 40,000 people were killed or maimed in the past 4 years of conflict in Afghanistan and 170,000 people newly-displaced this year alone, U.N. emergency humanitarian coordinator Mark Lowcock said.

He welcomed talks between the government of President Ashraf Ghani and Taliban insurgents, saying they needed to be supported.

“That probably is also the single biggest thing that will contribute to better economic prospects and people feeling more confident about the prospects and then that is what will be biggest driver in Afghans feeling they can go home,” he added.