Many people are delighted by Donald Trump’s election last week. There are (some) Republicans. Some Immigration and Customs Enforcement officers. Alt-right online trolls and opponents of free trade. Add to this list Turkey’s Islamist president, Recep Tayyip Erdogan.

Erdogan himself has already invited Trump to Ankara. In an interview after the election, he said he thought the US and Turkey could cooperate more on Syria.

So why is a Turkish leader whose political party is a coalition inspired by the Muslim Brotherhood so happy about a president-elect who pledged at times to ban Muslim immigration into the US?

Much of this has to do with the status of Fethullah Gulen, a Muslim cleric who lives in the Pocono Mountains of Pennsylvania. Erdogan says Gulen orchestrated the failed coup against him in July. Since that uprising, Erdogan has purged thousands of Gulen loyalists from Turkey’s schools, courts and bureaucracy.

President Barack Obama denounced the coup attempt, but so far his administration has not asked a US court to review Gulen’s status as a permanent resident or to consider evidence Turkey has provided to the Justice Department in support of allegations that Gulen played a role in the coup.

Enter Michael Flynn, a retired general who led the Defence Intelligence Agency for two years under President Obama, and is the odds-on favourite to be Trump’s national security adviser. On November 8, the Hill Newspaper ran an op-ed by Flynn that said America should not provide Gulen a safe haven, arguing that he was Turkey’s Osama Bin Laden. In recent days, I have been asked by Kurds, Turks and supporters of Gulen what to make of Flynn’s Election Day column.

So I called up a US national security official advising the Trump transition team who is in regular contact with Flynn. This source told me to think about the op-ed as a diplomatic overture. Flynn’s op-ed was meant to be an offer for Erdogan to fully commit to the war against Daesh in Syria.

In this sense, Flynn’s op-ed hit all the right notes to signal to Erdogan that it would be worth his while to be a better ally to America under a President Trump. To start, Erdogan is convinced that Gulen and his supporters were supporting Hillary Clinton. Bob Amsterdam, a counsel to the Turkish government who has focused on the Gulen issue, told me on Wednesday, “In my view, there is absolutely no question that Hillary Clinton’s involvement with Gulen constituted a direct threat to the government and people of Turkey.”

Amsterdam was referring to recent news stories that found some of Gulen’s friends were also major fund-raisers for Clinton. The Daily Caller for example reported over the summer that Gulen supporter Gokhan Ozkok was also a fund-raiser for a pro-Clinton PAC and that he had sent emails to Clinton’s aides in 2009 asking for help connecting an associate to former president Bill Clinton.

Jason Weinstein, a lawyer for Gulen based in Washington, told me, “I see no evidence to support what Mr Amsterdam is saying.” He added: “Gulen has millions of supporters all over the world. I don’t know who they supported in the election. My guess is because he is a pro-democracy Muslim, and given Trump’s rhetoric in the campaign, many of them may have supported Clinton.”

Weinstein also said that Trump could not just kick Gulen out of the country without first giving the exiled cleric a chance in court to defend his status as a permanent resident. “As the president-elect has said many times in the campaign, we are a nation of laws,” he said. “Because of that we hope and expect the law will be followed here. And if it is followed here, we are confident that Mr Gulen will not be returned to Turkey, where it is certain he will be subjected to torture, a sham trial and ultimately execution.”

Gulen has said he had no role in the aborted coup in July. Nonetheless, Flynn asserted that Gulen was guilty. “To professionals in the intelligence community, the stamp of terror is all over Mullah Gulen’s statements in the tradition of Qutb and Al Banna,” Flynn wrote, referring to two of the most important leaders of the Egyptian Muslim Brotherhood in the 20th century.

That sentence stands out because Erdogan himself is a product of the Muslim Brotherhood. When Mohammad Mursi, a member of the Muslim Brotherhood, was president in Egypt in 2012 and 2013, Erdogan was one of his strongest allies. Erdogan has also provided safe haven for leaders of Hamas, the Palestinian chapter of the group.

My source who is in contact with Flynn told me that the former spy chief’s language was deliberate. He said he wanted to provide Erdogan a choice to move away from the Islamist ideology of his own party.

Some Middle East analysts have panned Flynn’s column. Michael Rubin, a scholar at the American Enterprise Institute and an alumnus of the George W. Bush administration’s Pentagon, wrote on November 12 that Flynn may be the Trump team’s first ethics scandal, pointing to another Daily Caller report that said Flynn did not disclose in the op-ed that his consulting firm had a client with a prominent Turkish businessman and Erdogan ally on its board.

Eric Edelman, who served as an ambassador to Turkey under Bush, told me Flynn’s approach is “essentially a blank check to Erdogan, who is in the process of pushing Turkey towards a civil war that has very little to do with Gulen”.

That may be true. But Flynn is hoping his offer of a reset could entice Erdogan to give more troops, allow more coalition flights and provide more aid to Syrian rebels. My source close to Flynn told me his offer to Erdogan could also give the US another option in Syria besides working more closely with Russia and Syrian Kurds against Daesh. “This is about creating better options than we have right now,” this source said.

It remains to be seen how all of this will play out. But one casualty of a closer relationship between the US and Turkey would be the partnership Obama has forged with Syrian Kurdish groups. For a year and a half, Erdogan has waged an internal war against his country’s own Kurdish population, even though he worked closely with Kurds in the first years of his presidency. In this same period, the US has started to arm and train members of Syria’s secular Kurdish opposition.

This has already led to Kurdish-Turkish clashes in Syria. Aldar Khalil, who is a member of the executive committee of the Democratic Society movement in Syria known as Tev Dem, told me: “We have paid thousands of souls from our fighting women and men who are fighting on the front line in the world’s war against [Daesh].” He added, “What worries us is the American silence towards the aggressive role of Turkey against our forces who are allied with the US.”

If Flynn’s op-ed is any indication of the Trump administration’s plans, Khalil would do well to find some new friends in Syria. And Gulen would do well to find another country that will protect him from a Turkish president seeking to bring him to justice.