The European Court of Justice has ruled that war criminals or suspected war criminals cannot be automatically barred from entering a European Union member state, although national authorities are not forced to accept them.

The court’s May 2 ruling comes after hearing the cases of two men, one Afghan and one with Croatian and Bosnian citizenship.

As reported by Deutsche Welle (DW), Germany’s international broadcaster, the court ruled the severity of their crimes or alleged crimes and how long ago they took place need to be taken into consideration before an entry ban is permitted.

“The need for a restriction on the freedom of movement and residence of an EU citizen, or a family member of an EU citizen, suspected of having, in the past, participated in war crimes must be assessed on a case-by-case basis,” the court said.

The court heard the cases at the behest of the Netherlands and Belgium, which both repeatedly denied asylum to the men.

The Croatian-Bosnian, referred to as K. in the court’s decision, had been denied asylum in the Netherlands three times. He was also banned from entering the country, before eventually being admitted as an “undesirable immigrant” in 2015, following Croatia’s accession to the EU. K’s case was referred to the ECJ by the District Court of the Hague in Middelburg, Netherlands.

According to DW, K. was found guilty of war crimes and crimes against humanity during his time in the Bosnian army. Dutch authorities cited the need to protect public safety and shield citizens from contact with war criminals as the grounds for denying K. asylum. They specifically pointed to the need to protect victims and their families from encountering their abuser.

The Afghan, H.F., was also denied asylum in the Netherlands and later Belgium. In 2013, he applied for residency in Belgium as an EU citizen’s family relation, citing his daughter’s nationality in the Netherlands. His Belgian request was denied because information in his Dutch application suggested he had participated in war crimes or crimes against humanity in Afghanistan or given others orders to do so.

In its decision, the court emphasised the fact that a prior denial of refugee status did not automatically infer an individual would pose a threat to public safety, reported DW.