Relations with the United States were not much better, as both countries tightened visa requirements in a crisis ignited by Turkey’s arrest of two of its citizens who worked for the State Department in Turkey.
With just days left before the end of the year, however, Mr. Erdogan appears to have had a change of heart.
On Wednesday night, Mr. Erdogan signaled a rapprochement with European leaders in an interview with Turkish reporters aboard a plane to Tunisia.
“I always say this: We are obliged to lessen the number of foes and increase the number of friends,” Mr. Erdogan said in comments reported by several Turkish news outlets and translated into English by Hurriyet Daily News, an English-language Turkish newspaper.
“We have no problems with Germany, the Netherlands or Belgium,” Mr. Erdogan said. “To the contrary, those who are in the governments of these countries are my old friends.”
He also said he hoped to visit Paris to meet with the French president, Emmanuel Macron, and to travel to the Vatican to meet with Pope Francis.
By now, the crosswinds of Mr. Erdogan’s public statements have sealed his reputation as a leader of changeable temperament who seems to shift Turkey’s policies along with his moods.
Analysts of Turkish politics were divided on the reasons behind the Turkish president’s about-face, but some took it as a sign of his desperation at ending the year ostracized internationally.
Mr. Erdogan’s comments on Wednesday were the result of “diplomatic isolation, period,” said Marc Pierini, the European Union’s former ambassador to Ankara, and now a visiting scholar at Carnegie Europe, a think tank.
“Look at where the recent trips of the Turkish president have been,” Mr. Pierini added. “He’s gone to Greece, made a terrible commotion there for domestic purposes, burned another bridge; went to Poland, a semi-rogue state in the E.U.; then went to Sudan, Chad and Tunisia. This is diplomatic isolation.”
Indeed, Mr. Erdogan’s sudden attempt at making nice with European nations came as a particular surprise, since his relationship with the continent seemed to have permanently soured this year.
Many of his most inflammatory comments came in the spring, when Mr. Erdogan sought to energize his nationalist base in the run-up to an April referendum that he badly wanted to win to expand the powers of the presidency.
Bashing Europe serves a domestic purpose: By demonizing the West, he hopes to win over voters disappointed with Turkey’s struggling economy or ambivalent about the extent of the crackdown.
But the baiting did not cease even after he won. In June, his government refused to allow German lawmakers to visit German troops stationed on Turkish soil. In July, it leaked the secret locations of French and American troops stationed in Syria.
In September, Mr. Erdogan returned to a theme by accusing German politicians of Nazism for questioning whether Turkey should join the European Union.
Mr. Erdogan has been shunned by several European leaders since February and March, when he lashed out at their refusal to allow his ministers to campaign on European soil during the lead-up to his referendum.
European politicians are also uncomfortable with Turkey’s descent into autocracy. Tens of thousands of Turks, some of them with European passports, have been arrested, fired or suspended in a crackdown on dissentthat accelerated after a botched coup in July 2016.
For his part, Mr. Erdogan is furious that other European countries offer sanctuary to Turkish Kurds campaigning for greater autonomy in southeastern Turkey, as well as to those he accuses of complicity in the failed putsch.
But there is also little doubt that Mr. Erdogan is in need of allies, even if they are issue-specific.
Speaking to reporters, Mr. Erdogan attributed his peace offering to the fact that Germany and Holland had supported his opposition to President Trump’s decision to move the United States Embassy in Israel to Jerusalem, in contravention of international law.
“I asked for their support on Jerusalem,” Mr. Erdogan said. “We are all on the same page.”
Mr. Erdogan may have been sincerely appreciative of European support for a cause close to his heart, said Soner Cagaptay, the author of “The New Sultan,” a recent biography of Mr. Erdogan.
“The centrality of Jerusalem for Erdogan and his administration — you can’t underestimate that,” Mr. Cagaptay said.
But relations soured this year even with formerly staunch partners, like the United States, even before Mr. Trump’s decision to move the United States Embassy in Israel.
Mr. Erdogan’s bodyguards attacked protesters in Washington in April; American forces continued to work with Syrian Kurdish troops, whom Mr. Erdogan views as terrorists; and United States prosecutors charged a Turkish gold trader who later alleged Mr. Erdogan’s involvement in a criminal scheme.
Though Turkey has improved its ties with Russia, particularly since the failed coup, the two governments disagree on the role of Kurdish militias in northern Syria and even, it seems, on the future role of President Bashar al-Assad.
Mr. Erdogan’s attempts at a rapprochement are unlikely to substantially improve European ties, since he has passed the point of no return with many European leaders, said Mr. Pierini, the former European Union ambassador.
Mr. Erdogan has made “a complete misreading of the mood in Europe,” Mr. Pierini said. “After the incidents last March and September, there is a broken bridge.”
Turkey’s assistance in the battle against the Islamic State, particularly as large numbers of European fighters try to return to Europe via Turkey, may persuade some European leaders to re-establish good relations with Ankara, Mr. Cagaptay said.
But Mr. Erdogan, who has so often reaped domestic rewards from stoking arguments with Europe, may himself be unwilling to commit to a long-term thaw in the European-Turkish relationship.
“If Erdogan sees his poll numbers are still not great,” Mr. Cagaptay said, “he won’t think for a minute before creating another crisis with European countries.”