Chancellor Angela Merkel offered the prospect of support for speeding up Turkey’s long-held ambition to join the European Union on Sunday in return for Ankara’s co-operation in helping Europe deal with its biggest refugee emergency since the Second World War.

Ms Merkel’s trip to Turkey was seen as a make-or-break attempt to defuse a crisis in which a million refugees are expected to arrive in Germany this year alone. German commentators described her visit as her most important since she won power in 2005.

The German leader held talks with Turkey’s President Recep Tayyip Erdogan and his Prime Minister Ahmet Davutoglu in the hope of securing Ankara’s help in reinforcing a buffer zone in the region to slow the tide of war refugees from Syria and Afghanistan currently entering Europe.

She said that in return Germany could help accelerate visa-free travel for Turkish citizens wanting to visit the EU. Stopping short of an offer to welcome Turkey into the EU, she pledged to push forward Ankara’s EU membership talks.

“I think we have used the crisis we are experiencing, through a very disorderly and uncontrolled movement of refugees, to achieve closer co-operation on many issues,” Ms Merkel said after the meeting.

Earlier this month, Ms Merkel reiterated her opposition to Turkey joining the EU, but she has come under increasing fire domestically over her handling of the refugee crisis.

In return Turkey pledged to take in migrants sent back by the EU. “Our priority is to prevent illegal immigration and reduce the number of people crossing our border. In that respect we have had very fruitful negotiations with the EU,” Mr Davutoglu said.

The Chancellor had described her visit to Turkey, which in 2014 took in more refugees than any other country worldwide, as her “damned duty”. There are currently two million refugees living in the country. “We want to create conditions in which refugees can stay nearer to home,” she said. Ms Merkel also hoped to persuade Turkey to agree to border controls at its frontiers, particularly on the Greek maritime border, in an effort to slow the numbers of refugees entering the European Union.

In return EU leaders have pledged a €3bn (£2.2bn) cash handout for Turkey, as well as greater international recognition and ultimately EU membership. “If it doesn’t work without Turkey why don’t you let Turkey into the EU?” Mr Erdogan was quoted as saying to EU officials recently. However Ms Merkel has made it clear that she is not yet ready to accept full Turkish EU membership.

Ms Merkel’s visit was full of potential pitfalls, not least because it took place only weeks before Turkey’s forthcoming 1 November general election in which President Erdogan and his ruling Islamic AK party are keen to avoid the impression of selling out to Europe.

But there were fears in Germany that mounting pressure caused by the refugee crisis in Europe might oblige Ms Merkel to make the kind of “dirty deal” with her Turkish hosts of which her own party and many other Germans strongly disapprove. Support for the ruling conservative Christian Democrats fell to a new low of 37 per cent according to an opinion poll published yesterday, with the party’s waning popularity attributed to its handling of the refugee crisis.

Meanwhile the country was still reeling yesterday from a knife attack on a politician because of her professed support for refugees. Henriette Reker, 58, the front-runner in Cologne’s mayoral election, was stabbed in the neck by a 44-year-old unemployed German who was said to have harboured grievances about migrants.

The Chancellor and her party have so far maintained that they are strongly against Turkey entering the EU because of its questionable human rights record.

One Turkish diplomat quoted before yesterday’s talks remarked: “You can’t criticise Turkey from Monday to Friday and then on Saturday come and beg for support”.

However most German commentators went out of their way to stress the importance of Ms Merkel’s visit. “It offers the single best – and perhaps only – opportunity to address the biggest mass migration in Europe since the Second World War,” remarked the Berlin-based European Stability Initiative. On Saturday Turkish coastguards reported that 12 refugees, four of them children – drowned while trying to reach the Greek island of Lesbos. Meanwhile an estimated 4,000 migrants from Syria and Afghanistan heading for Germany, Austria and other EU countries were still struggling to make their way through Croatia and Slovenia yesterday after Hungary closed its borders at midnight on Friday. Slovenia announced late yesterday that it was cutting its refugee intake to 2,500.

Croatia responded to the closure of the Hungarian border by bussing hundreds of refugees from its border with Serbia to the Slovenian border. Many had spent weeks walking through Greece, Macedonia and Serbia to reach the Croatian border. “They are fleeing from war, they are literally running for their lives,” said a spokeswoman for the UN refugee agency.