Mr. Erdogan was emboldened in 2007 when the military, which had staged four coups since the 1960s to protect Turkey’s secular character, tried to prevent Abdullah Gul, one of Mr. Erdogan’s allies, from becoming president because he was considered too religious. Mr. Erdogan defied the military and called early elections. His Justice and Development Party won a sweeping victory, and Mr. Gul’s nomination went forward. That experience, coupled with his concerns about the Syrian civil war and the renewal of civil war with separatist Kurds in Turkey, led Mr. Erdogan to more aggressively protect himself and his party by marginalizing the military and secularists and expanding the role of Islam and Islamists in civic life.
One of the more recent standoffs with the United States has similar roots. The two countries remain at odds because of Turkey’s decision to fight Kurdish forces in Syria, troops that have been key American allies in the battle against the Islamic State. Turkey also has refused so far to accede to Mr. Trump’s demand that all countries stop trading with Iran.
The Turks are particularly incensed that the Americans have refused their repeated demands to hand over Fethullah Gulen, an Islamic cleric and onetime Erdogan ally living in self-imposed exile in Pennsylvania who is accused by Ankara of orchestrating the aborted coup. So far, the Turks, who absurdly accuse the United States government of complicity in that 2016 coup attempt, have failed to provide sufficient evidence to merit Mr. Gulen’s extradition.
Turkey, which has ordered retaliation for the new American sanctions, has also detained 19 Americans besides Mr. Brunson as well as three Turks who work for the American consulates. Intensive negotiations, including with a Turkish delegation that visited Washington this week, have so far failed to resolve the conflict over Mr. Brunson, which has turned deeply personal.
At last month’s NATO meeting, Mr. Trump reportedly thought Mr. Erdogan had agreed to free Mr. Brunson in return for American help in facilitating the release of a Turkish national held by Israel, which took place within days. Instead of sending the pastor home, though, the Turks insisted that the United States first grant clemency to a Turkish state bank, Halkbank, and a Turkish bank official accused of violating sanctions on Iran.
Congress recently voted to withhold delivery of American-made F-35 jet fighters until the Pentagon assesses the risk of Turkey’s growing ties with Russia, which NATO considers a threat, and its insistence on deploying a Russian S-400 missile defense system that is supposed to be delivered next year and is incompatible with NATO defense systems.
The United States is not the only ally that Turkey has antagonized. Its bid for membership in the European Union, which was once seen as a way to encourage Turkey to make political and economic reforms and strengthen ties to other democratic nations, is widely considered blocked for the foreseeable future.