(Bloomberg Opinion) — It is hard to credit now, but there was a time, only a decade ago, when Turkey described its foreign policy doctrine as one of “zero problems with our neighbors.” But since then, Ankara has burned its boats with Israel over the Gaza Freedom Flotilla; angered Egypt by bitterly criticizing Gen. Abdel-Fattah el-Sisi’s military coup and supporting the Muslim Brotherhood; broken with Syria by assisting anti-Assad rebels (and more recently, invading the country’s northeast, there to forcibly repatriate refugees); and antagonized Saudi Arabia and the United Arab Emirates by siding with Qatar against their embargo.Now, Turkey is providing direct military assistance to the government of Libya, while the UAE and Egypt—along with Russia—back the rebel army of General Khalifa Haftar. After the failure of cease-fire talks sponsored by Turkey and Russia, President Recep Tayyip Erdogan promised to teach Haftar “a lesson.” If anything, Turkey’s foreign policy now seems designed to aggravate problems with all of its neighbors. How did it come to this? In the past 10 years, Turkey has descended from a vibrant Islamic democracy into a repressive authoritarian state. But this doesn’t explain its antagonistic relations with its neighbors: most governments across the Middle East are also repressive authoritarian states with predominantly Muslim populations. The answer is that Erdogan has actively sought to advance the cause of political Islam, both domestically and internationally. This aligns him with Qatar and against most of the other Arab nations, especially Saudi Arabia, Egypt and the UAE.Within Turkey, Islamization initially advanced with democratization. The Turkish military had been a stridently secular force; as its hold over the state waned, religion returned to politics, primarily in the shape of Erdogan’s Islamist AK Party. The military leadership formally opposed the AKP’s 2007 presidential candidate for being an Islamist, but Abdullah Gul was elected—a major turning point in Turkish politics. The political emasculation of the military allowed Erdogan, who had previously described democracy as “a vehicle, not a goal,” to dominate the scene.The failed 2016 coup attempt can be seen as an opportunistic bid by some elements in the military to capitalize on growing dissatisfaction among Turks over Erdogan’s consolidation of power. It also represents a deep and ongoing contest between Erdogan’s Islamists and other political forces.The fragility of Erdogan’s hold on power is illustrated by last year’s election of opposition party mayors in Istanbul and other major cities, and the fact that longtime political allies—including former Foreign Minister Ahmet Davutoglu, who conceived the “zero problems with neighbors” policy—have broken away from the AKP.This domestic trajectory has its parallel in Turkey’s foreign policy, which has grown more Islamist and militarist as Erdogan’s political hold has become more brittle.The falling out with Egypt holds the keys to understanding Turkey’s intervention in Libya. After the 2011 Arab Spring, Erdogan supported the Muslim Brotherhood’s ascent to power in Egypt and assisted the government of President Mohammed Morsi. When Morsi was overthrown by the military in 2011, Erdogan described it as “state terrorism.” He seems to view events in Libya as a reprise of those in Egypt: a military leader threatening to unseat a government conducive to Turkey’s worldview.Turkey has deep linkages to Libya, which is home to 25% of Turks living outside their country. Just as important, $18 billion in Turkish business contracts are underway in Libya, and the two countries share an exclusive economic zone. The Government of National Accord in Tripoli, backed by the United Nations and led by Prime Minister Fayez al-Sarraj, has Islamist elements—natural allies of Erdogan and the AKP.The GNA has been under sustained military attack by the Libyan National Army under Haftar, who opposes a political role for Islamists, as do his Egyptian and Emirati backers—potential allies of forces within Turkey that threaten Erdogan’s hold on power.Long-suffering Libya has become the battleground for a proxy war about the role of Islam in Middle Eastern politics. Neither Turkey nor the Middle Eastern states arrayed against it are likely to concede their objectives. With the failure of cease-fire talks, attention will return to the frontlines, where a bloody stalemate prevails. If Haftar had the military strength to take Tripoli, he would have done so by now. Significant increases in Turkish assistance could turn the tide in favor of the GNA, unless Haftar’s allies ratchets up their support for the LNA. Turkey’s problems with its neighbors, meanwhile, are only liken to get worse.To contact the author of this story: Kori Schake at [email protected] contact the editor responsible for this story: Bobby Ghosh at [email protected] column does not necessarily reflect the opinion of Bloomberg LP and its owners.Kori Schake leads the foreign and defense policy team at the American Enterprise Institute.For more articles like this, please visit us at bloomberg.com/opinionSubscribe now to stay ahead with the most trusted business news source.©2020 Bloomberg L.P.