Although Ankara is seemingly responding to westward-oriented pressures at home and abroad, it could still swing Turkey back to the right if it continues to pursue the politics of religion, especially while the Islamic State looms on its borders.

U.S. Vice President Joe Biden will visit Turkey on Jan. 23 at a crucial time in the country's history. Recently, Turkish politics have been like a pendulum. The country entered the 21st century with a tradition of strict separation of religion and politics as well as having a strong pro-West orientation in its foreign policy, following the legacy of its founder, secularist Mustafa Kemal Ataturk.

In the last decade though, Turkey has swung to the religious right with the rise of the conservative Justice and Development Party (AKP). Led by Turkish President Recep Tayyip Erdogan, the AKP oriented Ankara's foreign policy towards Muslim countries, also eliminating Ataturk's firewall between religion, politics and education.

The Turkish pendulum is ready to swing again. This time, there are two nearly opposite paths it could take -- one auspicious, the other ominous. The Jan. 12 Islamic State of Iraq and the Levant (ISIL) attack in Istanbul, which killed 10 tourists, signaled just how dire the path could become.

From a positive perspective, Turkey continues to be a thriving pluralistic society, despite 14 years of single-party rule by Erdogan, who wants to change the country's parliamentary form of government into a presidential system with himself at the helm. This may be a tall order for Erdogan. For starters, the country's economy is still controlled by large pro-Western businesses despite the president's attempt to create a crony class of capitalists by awarding mega construction projects to businesses supporting his party.

Turkey's pluralism extends into the political sphere as well. The country's 76 million citizens are split in the middle, between those who voted for the AKP and those who did not in the November 2015 polls.

Erdogan faces additional barriers: Turkey's 10-million-strong Alevi community will resist further erosion of the country's secular traditions. Nationalist Kurds, nearly half of Turkey's 10-12 million Kurdish community, oppose Erdogan politically. And despite his effort to control them, the Turkish high courts remain mostly independent.

On the foreign policy side, emerging threats may force Erdogan to rethink his objective of turning towards Muslim and Eurasian nations. Since 2002, he has sought to tilt Turkey away from its traditional Western allies. This policy was premised on the notion that by establishing better relations with countries such as Iran and Russia, and by breaking occasionally with Europe and the U.S., Ankara could gain Middle Eastern and Eurasian clout, rising as a respected regional power.

Instead, the opposite has happened. As a result of Turkey's policies in Syria, where Ankara has backed the rebels against Syrian President Bashar al-Assad, and in Iraq, where Erdogan threw his lot with that country's Kurds and Sunni Arabs, Turkey's regional influence has lost a lot of traction. Accordingly, today Turkey's four key non-European neighbors -- Russia, Iran, Iraq and Syria -- are joined in a historic, newly formed axis against Ankara. Turkey's only real ally is Washington.

NATO's value, too, has gone up in Turkey. Erdogan knows that following the Nov. 24, 2015, incident, in which Turkey shot down a Russian warplane that violated Turkish airspace, Russian President Vladimir Putin could not treat Turkey with outright aggression only because Turkey was a NATO member.

At the same time, Turkish-European Union relations are blossoming. Brussels needs Turkey's help controlling refugee flows into the union. This revival also means that Ankara's EU accession process, once frozen, is thawing. On Dec. 15, 2015, Ankara and Brussels agreed to open a new chapter in Turkey's membership process, working toward harmonizing economic and monetary policies.

The positive potential trajectory ahead for Turkey is that while the country's pluralism tempers Erdogan's agenda, rapprochement with Washington and the rejuvenated EU accession process will breathe life into liberal democracy in Turkey.

And then there is the gloomy trajectory, whereby the Turkish pendulum could swing further right, causing the country to fall prey to jihadi radicalization. Under Erdogan, the politics of religion influences almost everything in Turkey. For instance, secular education, a key creation of Ataturk, is all but gone; in December 2014, Turkey's Higher Education Council, a government-regulated body, issued a policy recommendation suggesting that mandatory courses on Sunni Islam be taught to all students as young as six in publicly-funded schools.

Some may argue that there is nothing wrong with Turkey's turn to religion. However, the problem with Islamization in Turkey is that the country's neighbors are not Baha'is or the Benelux.

Religion in politics is a competition in which the ugliest wins -- this is Erdogan's and Turkey's challenge as he infuses more religion into the Turkish body politic. Islamization opens the country to negative influences coming from ISIL next door in Iraq and Syria. There are already worrying signs of radicalization inside the country. For instance, most of the ISIL attacks since last summer, which have killed at least 145 people, were carried out by Turkish citizens radicalized by ISIL in Syria.

In foreign policy, too, religion could trap Turkey. Ankara is currently locked in a proxy war in Syria against Russia and Iran, which support the al-Assad regime. Erdogan's visceral commitment to ousting the al-Assad regime leaves Turkey with just two allies on the ground -- Qatar and Saudi Arabia -- known for their backing of Islamist groups. Further radicalization in Syria will breed further radicalization inside Turkey. In Ankara, Mr. Biden should emphasize that Turkey can avoid such calamity by doubling down on its commitment to the West and swinging back towards democracy.

Soner Cagaptay is the Beyer Family Fellow and director of the Turkish Research Program at The Washington Institute.