German Chancellor Angela Merkel's Christian Democrats (CDU) have reached a deal on migrant policy with her conservative Bavarian allies, removing a major obstacle to pursuing talks on a coalition with other parties.
The agreement, under which Germany would accept around 200,000 people a year on humanitarian grounds but not refer to it as an "upper limit" on refugees, came after around seven hours of talks on Sunday between leading members of the CDU and Bavaria's Christian Social Union (CSU).
Merkel won a fourth term as chancellor in a September 24 election but was weakened by heavy losses to the far-right.
She wants to build a coalition between her conservative bloc and two other parties, the pro-business Free Democrats (FDP) and the Greens, who are far apart on issues from tax and energy to Europe.
First, however, she has to get her own house in order and overcome some major differences between her CDU and the CSU, its sister party in Bavaria, a state that accounts for 15 per cent of Germany's population.
The two parties have formed a parliamentary bloc together for decades, but have diverged over migrant policy since Merkel left the border open to a huge wave of migrants in 2015, most of whom entered the country through Bavaria.
The CSU has demanded a cap on refugees, but Merkel has resisted this, arguing it would breach Germany's constitution which guarantees the right of asylum to anyone facing political persecution.
Under the face-saving compromise brokered on Sunday, sources told Reuters Germany would accept around 200,000 people a year on humanitarian grounds, including families of refugees already in Germany.
However, authorities will not turn people away at the border and the word "upper limit" will not be used.
That target looks achievable, given that the number of people arriving in Germany fell from 890,000 in 2015 to about 280,000 last year. A further drop is expected this year.
In addition, the two parties agreed to push for an immigration law that would prioritise migrants with skills to plug gaps in the labour market. There is broad support for this from the FDP and Greens.
Talks are continuing on other policies, including pensions and Europe, but the migrant issue was the biggest problem.
Fearing heavy losses to the far-right Alternative for Germany (AfD) in a state election next year, the CSU has dug in its heels on the issue of a cap to the number of migrants.
The stakes are high for the CSU's combative leader Horst Seehofer, who is fighting for his political survival after a poor election performance.
Once the CDU and CSU have agreed on all their policies, they can start exploratory talks with the FDP and Greens.
It could still take months to get a full coalition deal and investors are concerned about the prospect of a policy standstill in Europe's biggest economy.
If no deal is reached, the prospect looms of either a minority government or new elections.