A Berlin conference has broken the ice between Turkey’s Recep Tayyip Erdogan and Angela Merkel as both leaders backed a truce in Libya. The two seemed extra warm toward each other during the chancellor’s Istanbul visit this week, after years of disagreements.

While consolidating his power by riding the wave of anti-Western sentiment, the Turkish president had repeatedly criticized, condemned and threatened European countries. Syrian refugees were his bargaining chip since a possible refugee influx was the biggest concern of the European Union. However, Erdogan saw an opportunity that could solve multiple problems for him as Germany seeks to boost its influence over the international scene.

The Turkish President had seemed ready for partnering with the European countries since last year, but Erdoğan wants European values left out this time – unlike the case during the first decade of his rule.

With lack of transparency, lack of rule of law, and local courts not recognizing ECHR orders, Turkey’s long coveted European Union membership is not in the cards. But Turkey’s commitment to the 2016 refugee deal has shown that burning the bridges with the top importer of Turkish goods wasn’t really an option.

Having no friends except Russia – a partner that consistently undermines Turkey’s position as a guarantor in Syria – is becoming unbearable for economically damaged Turkey. Greece, Israel and Egypt, among Mediterranean countries, seek to contain Turkey, counting on the country’s isolation from its Western partners, the EU and the NATO.

President Erdogan openly supported Libya’s Tripoli government as the Libyan civil war was coming to an end with Tripoli under a siege by Khalifa Haftar’s forces. The double deal signed between Ankara and Tripoli gave Libya’s Government of National Accord a chance to survive while Turkey, in return, has supported a maritime borders agreement that supports its claims in the Mediterranean.

European powers, ineffective since the ouster of Muammar Gaddafi, have seen Russian and Turkish efforts in Libya as a wake-up call regarding the security of the most important migrant route to Europe. Germany has attempted, with the conference in Berlin, to broker a truce between warring Libyan factions after years of ineffectiveness. Before the event, the Turkish president penned an op-ed for Politico, saying that “the EU needs to show the world that it is a relevant actor in the international arena.”

Turkey and Germany were on the same page about an issue, an immediate ceasefire in Libya, for the first time in five years. Following the conference, the German chancellor visited Istanbul and talked in favor of Turkish governments’ efforts to host the Syrian refugees (and not let them pass to European soil.)

Merkel promised more funds for refugees as well as support for resettlement projects for the people fleeing Idlib. As Russian air strikes target Idlib in what looks like a final offensive, Erdogan was happy about getting some support in the end. Germany’s attention to Idlib could be a lifesaver for the Turkish president, who seemingly has no exit strategy regarding Idlib and the jihadists who control it.

Turkey had already approached Germany by providing favorable conditions for a Volkswagen factory, including guaranteed sales amounts. Erdogan’s readiness for such a project has especially been mentioned in the mainstream Turkish media outlets, controlled by top government officials. It was clear that Turkey, whose currency has lost its value considerably in the past years, would be an ideal destination for such manufacturing businesses. But the German automative giant had cancelled the project as a reaction to Turkish incursion into northern Syria in the last October.

Merkel hasn’t focused on the Kurdish issue or on civil liberties and rule of law in her speeches. Her remarks have been limited to discussing the importance of critical thinking in science and the Turkish-German dual citizens whose travels abroad were prohibited by court orders. But her visits to NGOs that focus on media freedom gave a clear message.

On the same day, the Turkish Presidential Directorate of Communications canceled the press cards of scores of journalists who work for opposition papers, with no reason given. This move will put them under even more pressure and make them more vulnerable prosecution than ever.

Turkey’s willingness to start working together with the European powers again is clear. But it is clearer that the European values, freedom of speech and rule of law, won’t be a part of this new partnership.