German Chancellor Angela Merkel has reached a deal on immigration to end a row which threatened to break up her four-month-old coalition government.
Interior Minister Horst Seehofer, who leads her Bavarian CSU allies, has now dropped his threat to resign.
Mrs Merkel agreed to tighten controls at the Austrian border to stop people who have applied for asylum in other EU countries from entering Germany.
Transit centres will be set up to hold them until they can be sent back.
Mrs Merkel described the deal as a good compromise after tough negotiation.
But her centre-left Social Democrat (SPD) partners in the coalition voiced scepticism. Their spokesman on migration, Aziz Bozkurt, told the daily newspaper Die Welt that “transit centres are in no way covered by the coalition agreement”.
The SPD rejected a proposal for such centres in 2015, when the migrant numbers entering Bavaria from Austria were far higher than now.
‘New border regime’
Mr Seehofer’s conservative Christian Social Union (CSU) is the Bavarian sister party of Mrs Merkel’s Christian Democrats (CDU).
The CDU-CSU deal speaks of a “new border regime” in Bavaria.
“After intensive discussions between the CDU and CSU, we have reached an agreement on how we can in future prevent illegal immigration on the border between Germany and Austria,” Mr Seehofer told reporters in Berlin.
The Austrian government says it is seeking clarification of that, and it is preparing measures to protect its southern borders with Italy and Slovenia.
- Gruelling migration talks end in draw
- Merkel’s Bavarian ally threatens migrant mutiny
- Chancellor Merkel: Germany’s shrewd survivor
Is the deal legal?
By Laurence Peter, BBC News
The deal raises various questions about fair treatment of asylum seekers, as well as questions about the functioning of Schengen – the EU’s passport-free travel across internal borders.
The idea of the new transit centres appears similar to the transit regime at airports, where travellers do not actually enter the country.
But in many cases it may not be easy for Germany to identify which irregular migrants have already registered in another EU country. So how long will they have to stay in a transit centre? Such centres may well need tight security, to keep out people-smugglers and other criminals. Would such a closed regime encourage abuse of human rights, or turn them into prisons?
There is much wrangling over EU asylum policy; it is being revised, so there are currently legal grey areas. Because of that, Mrs Merkel is making bilateral deals with EU partners.
For example, Germany and Austria are both in the Schengen zone and, under its rules, they reimposed temporary border controls because of “continuous secondary movements” of migrants. That is, migrants who moved to Central Europe from the country where they first arrived.
On Friday, the EU agreed to set up voluntary “controlled centres” across the EU, to separate refugees – those entitled to international protection – from other migrants. Germany could argue that the planned transit centres comply with that deal. But the language used is vague, lacking detail; governments appear to be doing political quick fixes.
What is the political compromise here?
Mr Seehofer had threatened unilaterally to empower border police to turn away migrants who had registered previously in another EU country.
Mrs Merkel opposed any such unilateral action – she insisted on agreement with EU partners.
Under her controversial open-door policy in 2015, more than one million migrants – many of them fleeing the wars in Syria, Iraq and Afghanistan – entered Germany.
Under the new deal, transit centres will screen migrants and send back those registered elsewhere – provided Germany has a bilateral agreement with the country concerned. That is a more regulated procedure than what Mr Seehofer had demanded.
If there is no such bilateral agreement, a migrant will go back into Austria. But it is not clear whether Austria’s screening procedures will mirror Germany’s.
Mrs Merkel says Greece and Spain have agreed to take back migrants stopped at the Bavarian-Austrian border who are proven to have entered their countries first.
But Italy – where most irregular migrants arrive – does not want to take back migrants who reach Germany.
The divisions within the German government reflect a bigger split in the EU over migration. The Czech Republic, Slovakia, Hungary and Poland – the Visegrad Group – refuse to accept any migrants from other EU countries.