BERLIN — Chancellor Angela Merkel’s party suffered the latest in a string of defeats in German state elections on Sunday, when her Christian Democratic Union was ousted from power in Berlin after its worst showing in the capital since World War II, according to preliminary results.

Voters in Berlin turned out in higher numbers than in previous years, many responding to voter mobilization calls from the anti-immigrant Alternative for Germany party. The party is now poised to enter the city-state’s legislature for the first time, although its share of the vote, 14.2 percent in the preliminary results, was less than what it was two weeks ago in Ms. Merkel’s home state, Mecklenburg-Vorpommern, where it placed second.

Ms. Merkel’s party won 17.6 percent of the vote in Berlin, not enough to allow it to continue as the junior partner in a governing coalition with the Social Democrats. The center-left Social Democratic Party earned 21.6 percent of the vote and is expected to form a government with two other parties: the Left Party, with 15.6 percent, and the Greens, with 15.2.

“We are all angry that the AfD got in,” Michael Müller, Berlin’s mayor and the Social Democrats’ leading candidate, told cheering supporters in the capital, referring to the Alternative for Germany party. “But I can assure you that Berlin will remain an international city, open to the world.”