German Chancellor Angela Merkel reached a deal on migration with her rebellious interior minister, Horst Seehofer, defusing a bitter row that had threatened her government. Both sides hammered out "a truly good compromise . after a tough struggle and difficult days," Merkel said yesterday, adding that it involved setting up holding and processing centres for asylum seekers near German borders. "We have reached an agreement after very intense negotiations," Seehofer agreed, stressing that he intended to stay on in his cabinet post after earlier threatening to quit and gloating that "it's worth fighting for your convictions". "We now have a clear agreement how to prevent illegal immigration across the Austrian-German border in future," said Seehofer, whose CSU is the traditional Bavaria state ally of Merkel's CDU party. The deal still requires the consent of Merkel's other coalition partner, the centre-left Social Democrats, to become government policy. It drew immediate fire from critics, such us Bernd Riexinger of the opposition far-left Die Linke party, who on Twitter slammed the plan for what he labelled "mass internment camps" and judged that "humanity got lost along the way". Nonetheless, for now the deal suggested that Merkel - in power for over 12 years, and the EU's longest-serving leader - goes on to live another day after surviving the latest bruising challenge to her authority. Merkel has faced a strong backlash, and been weakened at the polls, over her 2015 decision to keep open German borders to a mass influx of migrants, many from war-torn Syria, Iraq and Afghanistan, that led to more than one million arrivals. Public anger and fear about the newcomers has given rise to the far-right, anti-Islam Alternative for Germany (AfD) party, which entered parliament last year and threatens Seehofer's CSU in Bavarian state polls in October. Seehofer, a long-time Merkel critic, had openly challenged her with a plan to order border police to unilaterally shutter German border crossings with Austria to many asylum seekers, effectively daring the chancellor to fire him. The threat - and Seehofer's subsequent warning he may resign - had raised the spectre of an imminent break in the seven-decade-long partnership between their conservative CDU and CSU parties. This would have deprived Merkel of her narrow parliamentary majority and forced her to either seek a new coalition partner or call a second election within a year, after scoring poor results in last September's vote. That scenario scared all parties except the anti-immigration AfD which, polls suggest, could hope for further gains. As Merkel won key concessions from EU partners on toughening migration rules, Seehofer and the CSU faced increasing pressure from other parties to avert a historic coalition breakdown. The CSU softened its stance in the face of withering criticism across party lines and poor polling results, insisting that the alliance with the CDU must live on. The flashpoint issue was Seehofer's demand to order German border police to immediately turn back all asylum seekers already registered elsewhere in the EU, and his threat to do so against Merkel's wishes. Merkel rejected such unilateral German measures and pledged to reach bilateral deals instead with other EU states. In yesterday's deal, both sides agreed to set up closed "transit centres" - similar to existing facilities at airports - that would allow German authorities to speedily process applicants. Those who are rejected could be sent back to their EU arrival country if that state agrees, says the joint CDU\/CSU plan. In cases where no such bilateral agreements exist, the asylum seekers would be sent back across the border "on the basis of an agreement with Austria" that was to be negotiated, it said. While averting an immediate crisis, the plan also raised new questions - especially when it comes to Italy, the main arrival country for migrants crossing the Mediterranean. Rome's hardline Interior Minister Matteo Salvini has stressed that his overburdened country is not ready to take in any more migrants.