German chancellor Angela Merkel's Bavarian conservative allies have thrown their weight behind her quest for a fourth term in office.

The endorsement puts aside a long-running argument over her migrant policies as Germany prepares for a national election in September.

The show of conservative unity came as Mrs Merkel's rivals, the centre-left Social Democrats, are enjoying a strong poll boost from their surprise nomination as her challenger of Martin Schulz, the former president of the European Parliament and a relatively fresh face in national politics.

Bavaria's Christian Social Union (CSU) has dominated its south-eastern state for decades and is traditionally an important source of national election votes for the bloc led by Mrs Merkel's Christian Democratic Union (CDU).

Their sometimes-awkward alliance has been frayed since late 2015, with CSU leader and Bavarian governor Horst Seehofer one of the most prominent domestic critics of Mrs Merkel's welcoming approach to migrants.

A year ago, he threatened her federal government with a lawsuit if it did not take measures to further secure the German border and reduce the influx of asylum-seekers, a threat never carried through.

More recently, the CSU raised doubts about whether the parties would campaign together.

Mrs Merkel, Germany's leader since 2005, announced her candidacy in November.

"We are going into this election campaign together," Mr Seehofer said on Monday after the parties' leaders met in Munich. Under Mrs Merkel, he said, "Germany is an island of stability".

Mrs Merkel acknowledged that the conservatives had taken their time to move past their dispute and focus on the September 24 election.

She said: "We needed time to make sure about the question of whether what we have in common is viable, and I am convinced that it's better to take one day longer.

"I think we have enough time until September 24 to set out this common ground to the population."

However, the parties still disagree on a CSU demand for an annual cap of 200,000 on the number of refugees allowed into Germany. Mr Seehofer has insisted his party will not join the next government without one, a dispute that both leaders skirted.

Germany saw 890,000 asylum-seekers arrive in 2015 and 280,000 last year, many of those before the Balkan migrant route was effectively shut by border closures from other nations.

Much has changed since the migrant influx peaked in 2015.

While Mrs Merkel insists that Germany will continue to take in people who genuinely need protection, her government has toughened asylum rules and declared several countries "safe", meaning people from there cannot expect to get refuge.

The chancellor was also a driving force behind an agreement between the European Union and Turkey to stem the flow of migrants and favours a similar deal with countries in North Africa.

She has also called for a "national effort" to ensure that rejected asylum-seekers leave Germany.

The CDU and CSU currently govern Germany in a "grand coalition" of the country's biggest parties with the Social Democrats, who nominated Mr Schulz as Mrs Merkel's challenger two weeks ago. Both sides want to end that alliance.

Several polls have shown the Social Democrats' previously moribund support picking up significantly, cutting what was a very large conservative lead.

It is far from certain, however, whether their momentum will last.

Mrs Merkel said: "We have to set out our policies well, and we must run together, and then we've gained a great deal."

The conservatives also face a challenge on the right from the nationalist Alternative for Germany party, which hopes to enter the national parliament for the first time after assailing Mrs Merkel's welcome for migrants.