Germany can impose residency restrictions on some of the migrants it takes in if doing so helps with their integration, the European Union's top court ruled Tuesday, as Berlin considers extending the practice to help deal with the recent refugee surge, dpa reported. Europe has been struggling to respond to an influx of migrants and asylum seekers over the last year, including people fleeing the war in Syria. Tuesday's ruling relates to two Syrians who arrived far earlier, in 1998 and 2001. Germany granted them subsidiary protection - awarded to people who do not qualify for asylum but are thought to be at risk in their home country - as well as welfare benefits. But their residency permits were tied to specific locations in Germany. Berlin has argued that this practice helps to distribute the cost of welfare benefits evenly and makes it easier for people to integrate into German society. German Interior Minister Thomas de Maiziere now wants to extend such residency restrictions to all refugees in Germany who have no job and cannot cover their own living expenses, for a period of up to three years.