BERLIN -- Chancellorl's conservative bloc won a lackluster victory in Germany's national election Sunday while the anti-migrant, nationalist Alternative for Germany party managed a triumphant entry into parliament, projections showed.
Merkel's main center-left rivals, the Social Democrats, were set for their worst result since World War II. The party, led by Merkel's challenger Martin Schulz, vowed immediately to leave her coalition government and go into opposition.
The outcome puts Merkel on course for a fourth term as chancellor -- but means that she has a tricky task in forming a new coalition government.
Projections for ARD and ZDF public television, based on exit polls and early counting, showed Merkel's Christian Democratic Union and their Bavaria-only allies, the Christian Social Union, winning around 33 percent of the vote -- down from 41.5 percent four years ago. It was one of their worst post-war showings.
Schulz's Social Democrats were seen trailing far behind, with 20-21 percent support. That would be the outright worst post-war for the party, which has served since 2013 as the junior partner in a "grand coalition" of Germany's biggest parties under Merkel.
Merkel was greeted at her party's headquarters by supporters applauding and chanting "Angie!"
"Of course, we would have preferred a better result, that is completely clear," she said. "But we mustn't forget that we have had an extremely challenging parliamentary term behind us."
"We have a mandate to form a new government, and no government can be formed against us," Merkel added.
"We want to win back AfD voters by solving problems, by taking account of their concerns and fears, and above all with good policies," Merkel added.
Smaller parties were the chief beneficiaries of the erosion in support for Germany's traditionally dominant parties -- above all the right-wing Alternative for Germany, or AfD, which was set to win up to 13.5 percent of the vote. AfD capitalized on discontent with established politicians but particularly targeted those angry over the influx of more than 1 million mostly Muslim migrants into Germany in the past two years under Merkel.
AfD co-leader Alexander Gauland vowed that "we will take our country back" and promised to "chase" Merkel.
"This is a big day in our party's history. We have entered the Bundestag and we will change this country," Gauland said.
Big cheers went up at AfD's election party after exit polls showed them finishing in third place. Some supporters chanted "AfD! AfD!" and others started singing the German national anthem.
Another big winner Sunday was the pro-business Free Democratic Party, which was set to return to parliament with 10.5 percent of the vote. The party was Merkel's coalition partner in her second term from 2009-2013 but lost all its seats at the last election.
"In a country that is big on schadenfreude, our comeback is an encouraging message - after failure, a new beginning is possible," party leader Christian Lindner told supporters.
The traditionally left-leaning Greens were seen winning around 9.5 percent of the vote and the Left Party some 9 percent, meaning both stay in parliament.
The new parliament will have six caucuses, compared with four previously, and the Social Democrats said they intend to lead the opposition.
"We have suffered a crushing election defeat," Schulz said. "It is completely clear that the role the voters have given us is as the opposition."
Referring to the AfD's third-place finish, he said "there cannot be a far-right party leading the opposition in Germany."
If the Social Democrats stick to their pledge, Merkel will effectively have only one option to form her new government: teaming up with the Free Democrats and the Greens in an alliance that has never yet been tried in a national German government.
That combination -- known as a "Jamaica" coalition because the parties' colors match those of that Caribbean nation's flag -- will have to overcome the traditional distrust between both the Free Democrats and the Greens and between parts of Merkel's conservative bloc and the Greens.
The Left Party is incompatible with the conservatives and all others have voted not to work with AfD.
The 'Jamaica' alliance "could work ... the (conservative) Union, Greens and Free Democrats do have similar voters," said Karl-Rudolf Korte, a political scientist at Duisburg-Essen University.
Mainstream parties' leaders vowed a robust response to AfD's entry into parliament. Greens co-leader Katrin Goering-Eckardt told supporters: "there will again be Nazis sitting in parliament."
"We will not let one single attack on German democracy stand," she said, to applause.
Merkel has over the years pulled her party toward the center, but may now face new pressure for a more robust conservative image.
An often-awkward conservative ally, Bavarian Governor Horst Seehofer, who has long called for a fixed annual cap on the number of migrants that Germany accepts, said the result Sunday shows that the conservatives have "an open flank to the right."
"It is particularly important that we close this flank with ... clear political positions," he said.