German Chancellor Angela Merkel's conservatives settled a row over migration that threatened to topple her fragile governing coalition late on Monday evening after talks with her rebellious interior minister led him to drop his threat to resign.
But finally, after a dozen hours of meeting CSU leaders, Mr Seehofer offered to resign from his ministry and the party leader, before suspending his decision to engage in a final round of negotiations with Angela Merkel.
The leadership of Merkel's party approved a resolution Sunday stating that "turning people back unilaterally would be the wrong signal to our European partners".
However, the German leader has managed to cling on after securing a last-minute deal on immigration that had risked breaking up her four-month-old coalition government.
Sky News' Dominic Waghorn details how Angela Merkel turned around the latest political crisis involving the issue of immigration.
Leaders and lawmakers in Merkel's party, the Christian Democratic Union, on Monday afternoon stressed the importance of maintaining the seven-year conservative alliance between their party and Seehoefer's.
Public anger and fear about the newcomers has given rise to the far-right, anti-Islam Alternative for Germany (AfD) party, which entered parliament previous year and threatens Seehofer's CSU in Bavarian state polls in October. Other CSU bosses, however, refused to accept his departure and kept strategy talks going.
"We have reached an agreement after very intense negotiations", Seehofer agreed, stressing that he meant to stay on in his cabinet post after earlier threatening to quit and gloating that "it's worth fighting for your convictions". Whether the two conservative parties would be able to get Merkel's junior coalition partner, the center-left Social Democratic Party, to agree also was an open question.
Seehofer and Merkel have long had a hard relationship and sparred over Germany's approach to managing immigration on and off since 2015, when the chancellor welcomed refugees into the country.
The sources said that in Sunday's private party meeting, Seehofer said he had a "conversation with no effect" with Merkel when they held talks on Saturday about the European Union migration deal, AFP news agency reported.
After nearly 13 years in power, she finds herself openly challenged in her government and political family, fought in Europe, particularly by her neighbours in the East and Austria, and finally in conflict with US President Donald Trump on a multitude of topics.
On Friday, Merkel and the rest of the European Union leaders hammered out a vaguely-worded deal to share out refugees on a voluntary basis and create "controlled centres" inside the bloc to process asylum requests.
At the summit on June 29, European leaders reached a migration deal, under which EU member states will, on a voluntary basis, set up "controlled centers" to host and transfer migrants that landed on EU shores.
A document circulated by Merkel to coalition allies on Friday night outlined repatriation agreements with 16 countries and proposed reception centres in Germany where migrants would undergo an accelerated asylum procedure - measures that represent a significant hardening of her 2015 open-door asylum policy.
Merkel has insisted on Europe-wide solutions to handling the waves of foreigners trying to reach the continent and the standoff could spell the end of her fourth government.
"It's not about who comes out on top, but about what's right", Bavarian state premier Markus Soeder told the CSU gathering, according to news agency DPA.