FILE -- In this Wednesday, Sept. 12, 2018 photo Hans-Georg Maassen, left, head of the German Federal Office for the Protection of the Constitution, and German Interior Minister Horst Seehofer, right, shake hands as they arrive for a hearing at the home affairs committee of the German federal parliament, Bundestag, in Berlin, Germany. The leaders of German Chancellor Angela Merkel's governing coalition were trying Sunday to resolve a standoff over the future of the country's domestic intelligence chief and stabilize their six-month-old alliance. (AP Photo/Michael Sohn)

FILE -- In this Wednesday, Sept. 12, 2018 photo Hans-Georg Maassen, left, head of the German Federal Office for the Protection of the Constitution, and German Interior Minister Horst Seehofer, right, shake hands as they arrive for a hearing at the home affairs committee of the German federal parliament, Bundestag, in Berlin, Germany. The leaders of German Chancellor Angela Merkel's governing coalition were trying Sunday to resolve a standoff over the future of the country's domestic intelligence chief and stabilize their six-month-old alliance. (AP Photo/Michael Sohn)

BERLIN (AP) — Leaders of German Chancellor Angela Merkel’s governing coalition reached a deal Sunday to resolve a standoff over the future of the country’s domestic intelligence chief, a dispute that has further dented the image of their fractious six-month-old alliance.

The center-left Social Democrats have insisted that Hans-Georg Maassen be removed as head of the BfV spy agency for appearing to downplay recent violence against migrants, but conservative Interior Minister Horst Seehofer has stood by him.

ADVERTISEMENT

Last week, coalition leaders agreed to replace Maassen as head of the BfV but give him a new job as a deputy interior minister, a promotion with a hefty pay increase. The move prompted a backlash from furious Social Democrats, prompting party leader Andrea Nahles to call for the deal’s renegotiation.

On Sunday, coalition leaders agreed instead to make Maassen a “special adviser” at the interior ministry with responsibility for “European and international issues,” Seehofer said. He will remain at his current pay level.

In addition, a deputy interior minister and expert on construction issues, Social Democrat Gunther Adler, will now keep his job rather than making way for Maassen. Nahles will have to sell the new compromise to her party’s leadership on Monday.

“I think it is a very good signal that we took the criticism of our decision on Tuesday evening seriously and were able to correct it,” Nahles told reporters. She declared that “overall, the foundation has been laid for us to return to substantive work.”

A left-leaning Social Democrat deputy leader, Ralf Stegner, described it as “a good solution.”

The dispute has clouded the government’s future at a time when the three parties face major challenges in upcoming state elections, in Seehofer’s home state of Bavaria on Oct. 14 and in neighboring Hesse on Oct. 28.

The infighting appears to be weighing down their support, which hasn’t recovered since a national election a year ago in which all three coalition parties lost ground and the far-right Alternative for Germany entered parliament.

The coalition of Merkel’s Christian Democratic Union, Seehofer’s Bavaria-only Christian Social Union and the Social Democrats took office in March after Nahles’ party decided reluctantly to join up.

It has already been through one crisis that threatened its survival, when Merkel and Seehofer — a conservative ally, but a longtime critic of her initially welcoming approach to refugees in 2015 — faced off in June over whether to turn back some migrants at the German-Austrian border.

ADVERTISEMENT

Responding to violent right-wing protests following the killing of a German man, allegedly by migrants, in the eastern city of Chemnitz, Maassen said his agency had no reliable evidence that foreigners had been “hunted” down in the streets — a term Merkel had used.

A video posted by a left-wing group showed protesters chasing down and attacking a foreigner but Maassen questioned its authenticity.

Seehofer, Maassen’s boss, has insisted that Maassen is a “highly competent” employee who hasn’t violated any rules and said he won’t outright dismiss him. He accused the Social Democrats of running a “campaign” against Maassen.

Seehofer, who leads the CSU, became interior minister after giving up his previous job as Bavarian governor following last year’s national election. There is widespread speculation that a poor election performance in Bavaria next month could threaten his political future.