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.