ISTANBUL — Over the past year, the leaders of many NATO countries have viewed President Recep Tayyip Erdogan of Turkey as an in-house spoiler.
While they were trying to isolate President Vladimir V. Putin of Russia for his invasion of Ukraine, Mr. Erdogan referred to Mr. Putin as “my friend.” While other leaders worked to enlarge the alliance, Mr. Erdogan held up the process by seeking concessions for Turkey.
Then on Monday, suddenly, Mr. Erdogan flipped, dropping his objections to Sweden joining NATO and allowing the alliance’s summit to convene on Tuesday with a new sense of strength and unity.
Mr. Erdogan’s about-face is consistent with his political style: He often doubles down on policies he expects to strengthen him, and then unapologetically throws them out once their worth has diminished, analysts said.
In this case, he seems to have realize that he had little more to gain from continuing to block Sweden, but could potentially benefit much more from mending his sour relationships with the United States and his other NATO allies.
“This is not Erdogan’s first U-turn and will not be the last,” said Osman Sert, the research director for PanoramaTR, a Turkish risk analysis organization. “Mr. Erdogan knows he needs to do something to create a bridge to the West.”
For more than a year since Sweden applied to join NATO after Russia’s invasion of Ukraine, Mr. Erdogan has been the primary stumbling block, accusing Sweden of harboring dissidents whom Turkey considers terrorists, and vowing to let Sweden join NATO only after it had cracked down on them.
And Sweden responded, a win for Mr. Erdogan. Sweden has hardened its antiterrorism laws, amended its constitution and agreed to extradite a number of people Turkey has asked for.
Turkey won a few more concessions in announcing its acceptance of Sweden on Monday: Sweden agreed to continue its counterterror efforts and to increase economic cooperation with Turkey.
But other issues may have played a larger role in changing Mr. Erdogan’s mind, analysts said.
Turkey has been trying to buy F-16 fighter jets and other military equipment from the United States, but the deal has been held up by Congress, where some members said they would not approve it unless Turkey allowed Sweden to join NATO. Biden administration officials have denied that the two issues are linked, but a number of Turkish analysts said that informal guarantees from U.S. officials that President Biden would work to push the deal through likely played a large role.
Before private talks with Mr. Biden on the sidelines of the NATO summit in Vilnius, the Lithuanian capital, on Tuesday, Mr. Erdogan described their meeting as “the first step” in a stronger relationship.
“All of our previous meetings were like warm-up rounds, but right now we launch a new process,” Mr. Erdogan said.
He wished Mr. Biden good luck in the upcoming United States elections, saying that the two men could work together through the rest of the new five-year term that Mr. Erdogan won in May.
“Thank you very much,” Mr. Biden replied, saying he looked forward to cooperating “for the next five years.”
Mr. Erdogan was probably also aware that his NATO allies’ patience was beginning to wear thin and that continuing to hold out on Sweden’s membership bid would make relations even worse. Turkey is the only NATO country that has not imposed sanctions on Russia, which has led some Western officials to question Turkey’s loyalty to the alliance.
“Turkey made the assessment that the potential additional benefits they could gain by prolonging the process were no longer worth the pressure that Turkey would need to face,” said Ozgur Unluhisarcikli, the director of the Ankara office of the German Marshall Fund of the United States.
The shift, he said, also appeared to be part of an effort by Mr. Erdogan to move Turkey away from Russia and toward the West. That would be significant, if sustained, he said.
“Turkey and Russia did not and do not have a love affair,” Mr. Unluhisarcikli said. Instead, they engage in “competitive cooperation,” he said, and tend to get closer when Turkey feels distant from the West.
As indications of Mr. Erdogan distancing Turkey from Russia, he cited Turkey’s decision to allow fighters from Ukraine’s Azov Regiment to return to Ukraine from Turkey last weekend, angering Russia, as did Mr. Erdogan’s failure to stand unambiguously by Mr. Putin as Wagner mercenary forces marched toward Moscow in June.
“Erdogan might have assessed that putting all the eggs in Putin’s basket is not a good idea,” he said.
On the flip side, allowing Sweden into NATO and working out the F-16 agreement could allow Mr. Erdogan to warm up what has been a chilly relationship with Washington.
Mr. Biden has kept Mr. Erdogan at arm’s length since he entered the White House. During his electoral campaign, he characterized Mr. Erdogan as anti-democratic and vowed to support the Turkish opposition. Mr. Erdogan, for his part, had cordial relations with former President Donald J. Trump.
Mr. Biden and Mr. Erdogan have previously met during Mr. Biden’s presidency, but Mr. Biden is the first U.S. president not to host Mr. Erdogan in the White House since the Turkish leader began his national political career in 2002.
Gulsin Harman contributed reporting.