Germany’s Chancellor Angela Merkel and her rebellious Bavarian allies have reached a compromise to end a dispute over managing immigration that threatened to bring down her coalition government.

Interior minister Horst Seehofer, leader of Mrs Merkel’s Bavarian-only sister party emerged from talks late on Monday saying the compromise will “prevent the illegal immigration on the border between Germany and Austria”.

Mr Seehofer, leader of the Christian Social Union, had been in a stand-off with Mrs Merkel over his plan to turn back at Germany’s borders any asylum-seekers who had registered in another European Union country.

Horst Seehofer arrives for  talks in Berlin
Horst Seehofer is leader of the Christian Social Union (Michael Sohn/AP)

Mrs Merkel refused, saying a solution that involves other European nations was needed.

Mr Seehofer offered his resignation as party leader and interior minister at a CSU meeting on Sunday night, but was convinced to resume negotiations with Mrs Merkel.

He did not give details of the compromise, but said he no longer intends to resign.