BERLIN (Reuters) - Chancellor Angela Merkel's coalition government agreed on Thursday to require migrants granted residence rights to show willingness to integrate by learning German and seeking work or see their benefits cut.
Ending months of disagreement, Merkel's Christian Democrats (CDU), their conservative Bavarian CSU allies and the Social Democrats (SPD) hammered out a deal in the early morning hours for post-war Germany's first law on integrating immigrants.
They also worked out new counter-terrorism measures and agreed to relax rules giving European Union citizens priority in employment so migrants can enter the job market more easily.
The deal capped months of disagreement about how to handle over a million migrants and refugees who poured into Germany last year. Those fleeing war in Syria and Iraq have the best chances of staying while economic migrants may be sent home.
Merkel said the agreement, to be approved by her cabinet on May 24, contained "an offer for everyone, but also duties for everyone". Along with language learning, it says that migrants who break off job training courses will also lose benefits.
The chancellor said Germany faced two challenges with Europe's migrant crisis. The first was to coordinate the influx of refugees with European partners and progress had been made on that, she said.
"The other challenge is to register and achieve the integration of the large number of people who have arrived here," she told reporters.
"We will have a German national law on integration - this is the first time in post-war Germany that this has happened, it is an important, qualitative step."
Tensions within Merkel's coalition mounted towards the end of last year with all three parties espousing different priorities for coping with the migrant crisis.
Since then, the flow of migrants, many from Syria and other war-torn parts of the Middle East and Africa, has slowed and the pressure has eased. The EU has also done a deal with Turkey to enlist its help in stemming the influx.
The security measures, a response to recent attacks in France and Brussels, include increasing police powers to deploy undercover agents and empowering Germany's intelligence agencies to exchange information with foreign partners, under clear conditions.
Last month, German authorities stepped up security measures at airports, train stations and the country's borders with Belgium, France, the Netherlands and Luxembourg.
While the three parties welcomed the immigration agreement, a closely-watched decision on incentives for electric cars was delayed.
Merkel said support for electric cars was in the pipeline. Auto sector leaders have pressed the government to bring in incentives to boost demand for electric cars, arguing support is needed if the sector is to retain its leading edge as an automotive market.
Writing by Paul Carrel and Madeline Chambers; Editing by Tom Heneghan