A series of compromises have been made which secure Merkel's government but have upset several German oppostion groups.
The German Chancellor, Angela Merkel, has secured a last-minute deal on migration with her interior minister, Horst Seehofer.
A series of compromises were made including one that means migrants who’ve been registered in another country cannot enter Germany.
Seehofer said it was enough to stop him from resigning and that it was the result that was important.
It follows weeks of dispute, which threatened the coalition government. But the move has had a mixed respons.
Katrin Göring-Eckardt, the faction leader of the Greens said: "It is not only a great disappointment for me but it is a denial of joint European action. Mr. Seehofer didn’t win, Mrs Merkel didn’t win, but the democracy was damaged."
Christian Lindner, FDP party leader added: "This is by no means the big turnaround CSU politicians are talking about today. At the most it is just another one of many necessary tools for more order and control on the migration to Germany."
The compromise agreement includes plans to set up transit centres from where asylum seekers, already registered in other EU countries, will be sent back.
Mrs Merkel was supported by her Christian Democratic Union party and the Christian Social Union during meetings on Monday.
"We are willing to keep on working and to develop a final opinion," said the SPD leader and faction head, Andrea Nahles.
"When and how this will happen I cannot tell you at this point."
The deal would require a new border regime at the German-Austrian border and if consensus can’t be reached with neighbouring countries then asylum application will be rejected anyway.
Austria has condemned the plan.