As German Chancellor Angela Merkel faces the task of negotiating a coalition of her Christian Democrats (CDU) and Bavarian sister party the Christian Social Union (CSU) with the free-market liberal Free Democrats (FDP) and the Greens, finding a way to get the parties to agree on common migration and refugee policies will likely prove to be her biggest challenge. And success will be far from assured.
"The truth is, there is an arithmetical majority, but the four parties each have their own election mandates. Whether these can be allied without contradiction and in the interests of the country remains to be seen," FDP head Christian Lindner told Die Welt newspaper on Wednesday.
The so-called Jamaica coalition, named because the parties' colors of black, yellow and green correspond to the Caribbean country's flag, would need to overcome vast ideological and policy differences to unite as a stable government. So what are the potential stumbling blocks toward an agreement on migration?
The Free Democrats
In an interview with DW ahead of the election, Lindner alluded to the uncertainty which concerned many in Germany following the arrival of more than a million people seeking asylum in 2015 and 2016.
"We've got to get a grip on the situation. That's one of the cornerstones for any coalition, There have got to be changes in our immigration policy," he said.
The FDP's migration policy states there be no maximum number of people granted asylum due to persecution. It advocates creating a new category of humanitarian protection for refugees who have fled war zones and other dangerous situations, which would require them to leave Germany when there was peace in their home countries.
For this, he also declined to name an upper limit for the number of people who could be taken in each year but said a limit could be imposed if the country's capacity to accept them in became strained.
Though the Greens differ vastly from the FDP when it comes to many economic matters, their positions on refugees, asylum and migration are similar in many ways.
The Greens are strongly opposed to an upper limit for asylum seekers, calling it an "absolute no-go."
Like the FDP, they want to introduce a points-based, Canada style immigration policy and the possibility for people who arrived in Germany as asylum seekers to be able to apply to stay on as regular migrants under the points system.
However, unlike the FDP, the Greens do not believe Afghanistan is safe enough to deport rejected asylum seekers. They also called for family reunification for recognized refugees, which have been paused by Merkel's government, to resume, saying their party's "political compass" was oriented toward protection for refugees and human rights.
Read more: Germany's Green party: How it evolved
"In a coalition with us, just like with the CDU and the FDP, there will be no upper limit for refugees. The CSU must adapt to that if they seriously want to explore a Jamaica coalition," Greens chair Simone Peter told the Rheinische Post newspaper on Wednesday.
The Christian Social Union
It's the Christian Democrats' longtime allies, their Bavarian sister party the CSU, that may prove Merkel's biggest headache to forming a deal on migration.
The CSU wants a limit of 200,000 migrants a year. Bavaria was the main entry point for people seeking asylum in Germany via the Balkan route in 2015. Merkel has consistently ruled out a cap and the pressure on her has eased as the number of people arriving in Germany has sunk.
CSU leader Horst Seehofer, who has clashed with Merkel on migration policy, said he had agreed with the chancellor to approach possible coalition talks with a united front, but added they had to respond to voters' concerns. The CSU lost more than 10 percentage points in Bavaria, hemorrhaging voters to the right-wing populist Alternative for Germany which advocated closed borders and adopted anti-migrant rhetoric.
CSU deputy Manfred Weber said that despite differences with the other potential partners, he still thought a Jamaica coalition was possible.
"We'll sit together and talk with each other," Weber told the Bayern 3 radio station on Wednesday morning. "We need a policy that takes account of people's concerns," he said, echoing similar statements from other leading CSU figures including Seehofer.
The prospect of losing further support to the AfD in a state election next year is also a factor pushing the CSU to dig in its heels on migration issues.
Lessons from the north?
The current CDU premier in the northern state of Schleswig-Holstein, where a Jamaica coalition has been in force since June, saw room for compromise. Daniel Günther pointed out that the CDU had done well in other state elections post-2015 without insisting on a refugee cap and that stricter policies enacted since then had kept the number of asylum-seeker arrivals below the CSU's proposed limit anyway. However, he warned against aiming for blanket unity across all issues.
"The secret to our success was that every party accepted that, for such a coalition to work, individual parties needed to have clear victories in certain points," Günter told Deutschlandfunk radio on Wednesday.