Relations between Turkey and the EU have markedly improved in recent months and Trump has played a major role in that.

In the summer of 2016, two political earthquakes hit the European Union and Turkey within a month of each other. On June 23, the United Kingdom voted to leave the EU, triggering a major existential crisis within the union. Less than a month later, on July 15, the terrorist organisation FETO, having infiltrated the Turkish state and military, tried to overthrow Turkey’s democratically elected government. Although the coup failed, it had a profound effect on Turkey’s political scene and state institutions.

As both the EU and Turkey faced grave political crises, relations deteriorated further. The weak response by the EU to the FETO-led coup attempt and their reluctance to extend full political support to the Turkish government increased pre-existing tensions.

Before the summer of 2016, Ankara and Brussels already had serious disagreements on a number of points, including the Kurdish issue, democratic reforms and the way the Turkish security apparatus handled anti-government protests in 2013.

Two years have passed since that eventful summer and now it is time for both the EU and Turkey to hit the reset button. The visit by Turkish President Recep Tayyip Erdogan to Germany last week was a good first step in that direction.

The Turkish president described his trip as a “success” while his German counterpart, Frank-Walter Steinmeier, was less forthcoming, saying: “This visit isn’t an expression of normalisation – we are a long way from that – but it could be a start.”

Looking back on the past two years, there are indeed quite a few reasons for scepticism. Since 2016, there have been a growing number of political disputes between the two countries.

From the Armenian Genocide bill passed by the German Assembly in 2016, the Incirlik airbase crisis in 2017, the granting of asylum to individuals accused of being part of the July 15 coup attempt, the allegations of espionage against imams affiliated to the Turkish Directorate of Religious Affairs, the ban on campaigning imposed on Turkish politicians in Germany, Erdogan’s harsh criticism of the German political leadership using Nazi analogy ahead of the Turkish constitutional referendum in 2017, all the way to the jailing of German-Turkish journalist Deniz Yucel and Germany hosting members of FETO and the Kurdistan Workers’ Party (PKK), which Turkey considers a terrorist group – indeed a lot has happened over the past two years.

But there is also reason for optimism. In fact, over the past few months, there has been a rapid change in the climate of relations between the two countries and more generally between the EU and Turkey. There has been one main reason for this spectacular shift: US President Donald Trump.

Since he was elected president in November 2016, Trump has done much to spoil trans-Atlantic relations, with most EU leaders – especially German Chancellor Angela Merkel – demonstrating an outright aversion to his style of politics. His administration has managed to strain relations with Turkey as well.

In other words, the policies of the Trump White House have radically increased the desire in Brussels and Ankara for convergence on foreign policy, trade and security issues of major concern.

Even before coming to office, Trump pledged to go after NATO, and he did. He has attacked his NATO allies and accused them of not paying their dues. This encouraged the rest of NATO’s members to come together in a united front against his disruptive activities endangering the future of the alliance.

Trump has also caused significant damage to US economic relations with both the EU and Turkey. His decision to impose tariffs on steel and aluminium imports and his constant threats of levying heavy import taxes on European cars have angered Brussels, which is already concerned about the economic impact of the UK leaving the union. The Trump administration also recently slapped Turkey with a number of economic sanctions.

As the Trump-initiated trade war rages on, it only makes sense for the EU and Turkey to stick together. Turkey is the EU’s fourth largest export market and fifth largest source of imports; the EU is by far Turkey’s number one trading partner. And if there was one aspect of relations that thrived over the past two years of tensions, it was the economic ties.

In addition, Trump’s decision to unilaterally withdraw from the nuclear deal with Iran and to impose sanctions on the country’s oil exports has further destabilised US relations with the EU. European diplomats scrambled to save the deal, most recently proposing a special financial vehicle allowing companies to sidestep US sanctions. Turkey is also on board about preserving engagement with Iran, having declared that it would itself defy the sanctions.

Security is also another major field of cooperation that has brought Ankara and Brussels closer in recent months. Erdogan has worked hard to prevent another offensive by Syrian government forces and Russia in northern Syria, which could produce another wave of Syrian refugees heading to the Turkish border and potentially to Europe. The Turkish president has engaged with his European counterparts seeking a solution to the crisis, despite the Trump administration playing a continuously disruptive role, supporting a PKK offshoot in northeastern Syria and failing to come up with an unequivocal stance on a future peace process.

While pursuing rapprochement with the EU, Turkey is aware that after Brexit, Germany’s political weight within the union will grow significantly.

For Ankara, it is increasingly clear that better relations with the EU have to be pursued not through Brussels but through Berlin. While there are still many issues to resolve, today the interests of Turkey and Germany overlap more than ever.

From the migration crisis to trade wars, from the Trump problem to the Syrian crisis, and from rising populism to Islamophobia, the two countries need each other to resolve major challenges they are facing.

It is in the best interest of both countries, and the EU as a whole, to seek unity in times of increasing global polarisation, uncertainty and instability that leaders like Trump have brought about.

It is important to remember that 2018 marks 100 years since the end of World War I, which brought Turkey and Germany together in a close alliance and which ended with a Turkish-European geopolitical settlement still affecting their ties today. The Turkish reading of history produced a popular saying: “We were declared defeated because of Germany’s defeat.”

Today, Turkey is betting again on a close relationship with Germany, but this time Europe is different and so is the world. The 20th-century system of camps and axes is antiquated and should not be the basis of our reading of geopolitics today.

We have to recognise that Turkey and Europe have a geographical, demographic and economic interdependency, as well as major historical and cultural links, which will always pull the two back together, no matter the circumstances.

The views expressed in this article are the author’s own and do not necessarily reflect Al Jazeera’s editorial policy.