EU extends border controls in Austria, Germany, Scandinavia

People walk on their way to Idomeni camp, Greece, after trying to cross the Macedonia's border, Wednesday, May 11, 2016. Around 9500 stranded refugees and migrants are camped at the makeshift refugee camp of the northern Greek border point of Idomeni. (AP Photo/Petros Giannakouris) (The Associated Press)

A family walk on their way to Idomeni camp, Greece, after a group of migrants and refugees tried to cross the Macedonia's border, Wednesday, May 11, 2016. Around 9500 stranded refugees and migrants are camped at the makeshift refugee camp of the northern Greek border point of Idomeni. (AP Photo/Petros Giannakouris) (The Associated Press)

In this May 2, 2016 photo, a man carries laundry as he walks inside a residential house at the Sumte refugee shelter in Sumte, Amt Neuhaus, northern Germany. The village of only 102 people housed up to 1,000 migrants. Six months after the first arrivals, not only have fears of violence and overtaxed utilities not materialized, but the shelter has brought benefits including dozens of jobs to the sleepy village of 102 people and the isolated rural region of northern Germany where it is located. (AP Photo/Michael Sohn) (The Associated Press)

The European Union has decided with immediate effect to allow Austria, Germany, Denmark, Sweden and Norway to keep border controls in place for up to six months to deal with the migrant influx.

EU headquarters said in a statement Thursday that the controls should be "targeted and limited in scope, frequency, location and time, to what is strictly necessary to respond to the serious threat and to safeguard public policy and internal security."

It said the countries should inform each other of exactly where they plan to carry out the controls.

Germany reintroduced ID checks last year to cope with the arrival of hundreds of thousands of migrants.

Its legal avenues for keeping the controls in place were set to expire on Friday without this EU decision.