IT WAS meant to be a game-changer. When a deal between the European Union and Turkey was struck in March with the aim of limiting the numbers of asylum-seekers coming to Europe, many in Brussels felt cautiously optimistic. Angela Merkel, the German chancellor, claimed it offered a “sustainable, pan-European solution”. In exchange for visa-free travel for some of its citizens, €6 billion ($7 billion) in refugee aid and revived talks on possible future accession to the EU, Turkey was to take back migrants who had made their way to Greece and try to secure its borders. Faced with perhaps another million refugees making their way to Europe this year, it appeared to be the only way to bring some order to the chaos.

The number of refugees coming to Europe has indeed dropped (see chart). Yet the agreement is looking more and more murky. It risks undermining both the reputation of the EU and its relationship with Turkey, from whose shores hundreds of thousands of refugees set off last year on their journey to Europe.

Since the agreement Recep Tayyip Erdogan, Turkey’s president, has become even more openly and arrogantly autocratic, as if to show that he can flout European norms with impunity. On May 22nd he replaced the prime minister, Ahmet Davutoglu, who was the engineer of the migrant deal, with a loyalist, Binali Yildirim. The ousting was as smooth as it was ruthless. Save for a few vague references to party unity, no one in the ruling Justice and Development party bothered to offer a reason for Mr Davutoglu’s departure.

Mr Yildirim pledged to enshrine Mr Erdogan’s status as the party’s leader and executive president. Two days earlier Turkey’s parliament lifted the immunity of its members, opening the way for 50 of 59 MPs from the pro-Kurdish Peoples’ Democratic Party to face prosecution, mostly on spurious terror charges. Mr Erdogan accuses them of peddling propaganda for the Kurdistan Workers Party, an outlawed militia—an accusation they strenuously deny.

Mr Erdogan has also clamped down more forcefully on the press and potential dissidents. According to a report in May, nearly 900 Turkish journalists have lost their jobs in the first four months of the year, and 33 were detained. Prosecutors have opened more than 1,800 cases against people suspected of insulting Mr Erdogan since he was elected president in 2014. His reach even extends beyond Turkey. In April he exploited a German prohibition on insulting foreign heads of state to demand that Jan Böhmermann, a comedian, be prosecuted for reading a satirical poem on television that depicted Mr Erdogan in various obscene acts.

All this has spooked officials in Brussels. On May 23rd Mrs Merkel admitted that visa-free travel would not happen by July, as had been agreed on (somewhat unrealistically) in March. Turkey still needs to meet the EU’s final seven conditions (out of 72). These include issuing biometric passports; cracking down on corruption; becoming more co-operative with extradition requests; and, most controversially, narrowing the broad anti-terror laws it has used to harass journalists, academics and politicians. The EU’s Council of Ministers is developing new rules that would make it easier for Europe to suspend visa liberalisation for six months, or rescind it altogether, if circumstances change. Such contortions may make visa-free travel more politically palatable to Europeans wary of illegal immigration from Turkey. But they also make the deal look cynical.

The problem, says Marc Pierini of Carnegie Europe, a Brussels think-tank, is that the issues of visa liberalisation, EU accession and immigration should not have been mixed up in the first place. Turkey has been seeking visa-free travel for years. Including it in the refugee deal makes it a reward for doing Europe’s dirty work, rather than a way of granting Turkey more equal footing with the EU. The deal also gives Mr Erdogan a bargaining chip: if no visa-free travel is forthcoming, he could let refugees through to Europe once more. Even a few thousand would cause chaos: Greece is still overwhelmed by the 50,000 refugees stuck there since March.

If visa liberalisation does go ahead, Europe could lose much of its leverage over Turkey. “Europeans overstate the attraction of what they are offering,” says Hugh Pope of the International Crisis Group, an NGO. The idea of accession is less of a draw than it was in the mid-2000s, when Turkey was pushing through reforms. Support for the EU has increased: according to one poll 62% of Turks want to join the EU, up from 42% in 2015. But nearly seven out of ten believe Turkey will never be allowed in.

Most damaging, European leaders seem to be lowering standards in order to make the deal work. Few spoke out when the offices of Zaman, a formerly critical newspaper, were seized by the government in March. Other abuses, including the shelling of residential neighbourhoods during clashes with Kurdish insurgents, have been raised only hesitantly.

If visa liberalisation is granted after Turkey merely tweaks its laws, that would further undermine the EU. Many in Brussels are unhappy that it has sacrificed its principles to such an extent, says Marietje Schaake, a Dutch MEP. It sends the message that “if we need you badly enough, then everything can be talked about”. Yet it is not clear the EU can get a better deal. The message this one sends may be accurate.