The outcome in Schleswig-Holstein “confirms a nationwide trend that is giving wings to the Christian Democrats across the country that many of the Merkel critics within the Christian Democrats had considered impossible,” the Süddeutsche Zeitung newspaper wrote in a political analysis on Sunday. “Even though it is not clear who will become governor in Kiel, the chancellor and her supporters in the party have scored points that should help her in next week’s election in North Rhine-Westphalia.”

Even as their European partners have expressed displeasure with a more centralized European Union and the threat of increased immigration from the Middle East and Africa, Germans have largely tended to support stability at the ballot box. In March, voters in Saarland, Germany’s smallest state, returned Ms. Merkel’s party to power with 40.7 percent of the vote.

That was the first indication that Mr. Schulz might not be able to maintain momentum through the fall, despite driving support for his party over the Christian Democrats at the start of the year.

The nationalist, populist Alternative for Germany party passed the 5 percent vote threshold needed to make it into the state legislature in Schleswig-Holstein, entering the 12th of 16 state legislatures. But partial results showed that the party had earned only 5.9 percent of the vote.

The upstart party rode a wave of anger and uncertainty to considerable popularity in several eastern states last year, after Ms. Merkel’s decision to take in nearly one million refugees, but it has failed to perform as strongly in elections in the western states this year.