German Chancellor Angela Merkel‘s ruling coalition agreed Thursday on tough measures to spur the integration of migrants and refugees, including sanctions for failing to take part in programmes such as language classes.

The deal, hammered out in six hours of late-night talks between Merkel‘s conservative Christian Union bloc and the Social Democrats (SPD), also included plans for new anti-terror legislation.

“Now that hundreds of thousands of refugees have arrived in our country, we have a double task: to manage and control refugee flows, and not only to register but to integrate the large numbers,” Merkel said at a Berlin press conference on Thursday.

The new law would both “require things [of new arrivals] and support them,” Merkel continued.

“We will differentiate between those with good and bad prospects for being allowed to stay, but there will be an offer for everyone who comes to us,” she added.

“Integration in a society with people from very different cultural backgrounds doesn’t happen by itself,” said Vice-Chancellor Sigmar Gabriel, who claimed the new law was a “truly historic step”.

Indeed, it is the first time a law covering immigration and integration has been mooted since Germany began a postwar programme to invite Turks and other “guest workers” to fuel its economic miracle, which was criticized for failing to provide millions of immigrants and their descendants a stake in German society and a path to citizenship.

But Horst Seehofer, leader of the Christian Social Union (CSU), Merkel’s conservative Bavarian allies, said there was “still an enormous amount to do”.

Among other questions, the federal government has to agree with the states on how to require migrants to remain in one place while going through integration schemes into German society and the labour market, Seehofer noted.

Carrot-and-stick approach

The integration bill would take a carrot-and-stick approach, providing subsidized courses to help newcomers find their way in German life but, in some cases, denying residence permits to those who fail to take up the offer.

Under the new pact seen by AFP, federal funds would be used to create 100,000 jobs for asylum seekers receiving benefits.

Those facing imminent deportation would be excluded, but asylum seekers taking part in job training would be shielded from expulsion for the length of the programme.

Refugees who abandon state-assigned housing would face unspecified consequences, but waiting periods for acceptance courses teaching German language and customs are to be slashed to six weeks from three months currently.

“Learning the language is also necessary for temporary stays in Germany,” the document states.

More powers to combat terrorism

The right-left coalition also agreed to give more funding, personnel and powers to security forces to combat terrorism.

A significant new provision would allow federal police to deploy undercover officers for attack prevention as well as criminal prosecution.

It would also allow the secret services to step up cooperation with their counterparts from partner states in Europe and NATO as well as Israel.

The draft law is to be completed on May 24 and then presented to parliament, where the so-called grand coalition has a large majority.

Germany took in more than one million asylum seekers in 2015 and Merkel has faced mounting criticism from sceptics, particularly from within her conservative camp, arguing that Europe’s top economy is ill-equipped to cope with the influx.

The closure of the so-called Balkan route taken by many migrants has led to a sharp decline in new arrivals in recent weeks.

Read More: