American and Russian military forces should withdraw from Syria, according to the leader of a key NATO ally.

“If a military solution cannot help find a way out of the crisis, then those who think so should pull their troops out of Syria," Turkish President Recep Tayyip Erdogan said Monday, in remarks translated by Russian media.

Erdogan’s comment responded to a joint statement from President Trump and Russian President Vladimir Putin calling for an “ultimate political solution to the conflict” that has convulsed Syria since 2011. The Turkish leader, who made the comments before traveling to Russia, has long been seen as developing a closer relationship with Putin at the expense of western alliances.

In the beginning of our meeting I would like to point out that our relations may be considered as fully restored," Putin said Monday before hosting Erdogan in Sochi. "Our bilateral relations, as well as cooperation in resolving regional issues, provide us with an opportunity to look into the future together.”

That restoration reflects a sharp turnabout from May of 2015, when Turkey shot down a Russian fighter operating on its border with Syria. But the Syrian civil war developed into an opportunity for the two sides to enhance ties. The United States willingness to work with Syrian Kurds to defeat the Islamic State angered Erdogan, who regards the Syrian Kurds as part and parcel with the Turkish Kurds who have waged a separatist war against his government for decades.

“[The Americans] give support to terrorist groups,” Erdogan said in January, based on U.S. cooperation with the Kurds.

But Erdogan’s call for a withdrawal of U.S. and Russian forces from Syria isn’t a maneuver designed to help his renewed friendship with Putin, according to U.S. foreign policy analysts.

“The Turkish president is frustrated that both the U.S. and Russia have provided arms to and work with the [Syrian Kurds],” Aykan Erdemir, a senior fellow with the Foundation for the Defense of Democracies, told the Washington Examiner.

“Since the June 2016 rapprochement with Russia, Erdogan has tried to play Washington and Moscow against one another, hoping to gain leverage against the [Kurds] in Syria,” Erdemir, who is also a former member of the Turkish parliament, added. “So far, neither the U.S. nor Russia has accommodated Erdogan’s expectations. I believe that Erdogan’s outburst has more to do with his getting stuck between a rock and a hard place vis-à-vis the Syrian Kurds.”

Erdogan may worry that Russia and the United States will agree to a political settlement that leaves the Syrian Kurds in a stronger military position than he wants to tolerate, another expert suggested.

“He always saw the Kurds as a bigger threat to Turkey than ISIS and turned a blind eye to ISIS activities until ISIS started attacking Turkish targets,” the Heritage Foundation’s Jim Phillips, a senior research fellow for Middle Eastern Affairs, told the Washington Examiner. “He bitterly opposed U.S. support for Syrian Kurds fighting ISIS and would like to see Washington abandon the Syrian Kurds, get out of Syria and allow Turkey to carve out an area of influence inside Syria.”

Putin, who met with Erdogan in part to discuss the sale of Russian military equipment to the Turkish government, didn’t evince much concern about his Syria recommendation.

"Our bilateral relations, as well as cooperation in resolving regional issues, provide us with an opportunity to look into the future together,” Putin said.