GOERLITZ, Germany (Reuters) - Chancellor Angela Merkel’s conservatives on Sunday won a run-off vote for mayor in a small town in the east of the country, beating the far-right, anti-immigration Alternative for Germany party.

The vote in Goerlitz, a town with cobbled streets that has become a favorite location for Hollywood film directors, is seen as a pointer for German state elections on Sept. 1 in both Saxony and in the neighboring state of Brandenburg.

The victory of Christian Democrat (CDU) Octavian Ursu in Goerlitz is gives some respite to Merkel, whose national coalition with the center-left Social Democrats (SPD) was shaken by heavy losses in European Parliament elections in May.

AfD candidate Sebastian Wippel came out ahead of Ursu in the first round and the CDU had to rely on support from other parties in the runoff to win in the town of 56,000 near the Polish border. Ursu won the runoff with just over 55%.

“It was not a vote for Mr. Ursu but more a vote against the AfD candidate, against me,” said Wippel. “The CDU had to rely on support from many groups including from the far-left extremists without whom they would not have made it. Looking ahead to the Saxony state election, we are in a good position.”

Ursu said his victory showed that most residents in Goerlitz were in favor of keeping the town open to foreigners.

“I am happy that a majority has chosen to vote for me, but in the end it is not about two candidates but the orientation of this town to the outside world and that we remain an open society and do not isolate ourselves,” he said.

Slideshow ( 2 images )

The AfD is running neck-and-neck with the CDU in Saxony and is forecast to come first in Brandenburg where the SPD has won all of the last six elections there since German reunification in 1990.

Defeats for the SPD in Brandenburg and the CDU in Saxony would pile more pressure on the coalition partners to rethink their alliance that followed the 2017 election, where the AfD entered the national parliament for the first time.

The Brandenburg and Saxony votes take place several weeks before the SPD and conservatives hold a midterm review of their partnership.

The SPD, which rules Brandenburg with the hard-left Die Linke, is expected to see support fall by more than a third in the eastern state, polls show.

The AfD has been attracting SPD and CDU voters in Brandenburg and Saxony partly by campaigning on a platform that opposes the government’s plan to phase out coal, a vital industry in both states, especially in Brandenburg.

The coalition partners are also losing support to the Green party, which is appealing to voters disillusioned with the ruling coalition and concerned about climate change. The Greens are the most popular party in Germany, overtaking Merkel’s conservatives.