BERLIN (AP) — Chancellor Angela Merkel’s center-right party is joining forces with the environmentalist Greens and the center-left Social Democrats to freeze out a nationalist party in the eastern state of Saxony-Anhalt.

Merkel’s Christian Democrats came first in last month’s election with nearly 30 percent of the vote. But the upstart Alternative for Germany, or AfD, came a surprise second with more than 24 percent, shocking the established parties.

AfD has seen a surge in support amid disquiet among some Germans over Merkel’s immigration policy.

Social Democrat Burkhard Lischka described the three-party agreement as a “marriage of convenience” Tuesday.

It is the first time that a coalition composed of those three parties has been formed at the state level.

Party members still need to approve the coalition at the weekend.