The sprawling nation of Turkey is one of the United States' most important and critically strategic allies, straddling the divide between the Middle East and the West.
As the only majority-Muslim member of NATO, Turkey has lent its soil to U.S. air bases, supported American military operations in key conflicts — such as Syria today and the Balkans in the 1990s — and served, until recent years, as a rare friendly interlocutor between Muslim nations and Israel.
But Turkey has also been a complicated and prickly ally, and more so as President Recep Tayyip Erdogan deepened his autocratic hold on power.
Turkey's stability and the friendliness of its military toward the West are also of vital importance to the U.S. and for countries throughout Europe.
Turkey has been a NATO ally since 1952, and U.S. warplanes have used Incirlik Air Base in the south during the invasions of Afghanistan and Iraq.
An estimated 1,800 U.S. military personnel are assigned to the base and the U.S. Embassy in Ankara, the capital.
Security at Incirlik is of critical importance for the U.S. military because there is a stockpile of U.S. tactical nuclear weapons at the base.
The B61 thermonuclear weapon is the last of its kind, the only tactical nuclear bomb in the U.S. arsenal. Unlike strategic weapons, designed to destroy cities and hardened military targets, the tactical weapons are intended for use on a battlefield, delivered by aircraft at treetop level or from high altitudes.
The exact number of B61 bombs at Incirlik is classified, but arms control analysts estimate there are about 50 deployed there.
With the second largest army in NATO, Erdogan was initially hesitant to take part in the U.S-led effort against Islamic State militants in Syria. For Erdogan, the greater goal was ousting Syrian President Bashar Assad, and Erdogan was accused in some U.S. circles of turning a blind eye toward the threat of Islamic State.
However, after a series of high-profile suicide attacks in Turkish cities, Erdogan agreed a year ago to allow U.S. warplanes to fly combat sorties from Incirlik.
Since then, the intensity of the U.S.-led air war in Syria increased sharply because the flight time into Syria was drastically reduced compared with using other, more distant U.S. bases. The Pentagon in March ordered military family members to leave Incirlik due to the rising risk of possible terror attacks against Americans at the base.
Turkey has also begun to clamp down on smuggling routes along its 500-mile border with Syria that Islamic State militants use to move fighters, money and weapons -- especially along a porous 60-mile stretch known as the Manbij Pocket.
Thousands of foreign fighters have slipped across the border amid the maze of supply lines that go through Turkey to join the various militant factions in the multi-sided Syrian war.
The U.S.-led coalition, with Turkey's help, is in the midst of a massive, months-long operation to close the Manbij Pocket. Since the operation began, coalition warplanes have launched about 400 airstrikes to support ground forces known as the Syrian Arab Coalition to push the last remaining Islamic State fighters from the area.
The complications for Turkey, however, and Erdogan especially, persist. Erdogan sees Turkey's greatest threats as Assad, who has generally managed to hold on to power, and the array of armed Kurdish forces, some of whom have proven to be the United States' best-trained allies in fighting Islamic State. Erdogan sees most of the armed Kurdish groups as terrorists and chafes at their relationship with the U.S., which only regards one faction — the Kurdish Workers Party (PKK) — as a terrorist group.
Instability in Turkey introduces yet another element of uncertainty into the U.S. fight against Islamic State, said Nicholas A. Heras, a Middle East researcher and the Bacevich fellow at Center for a New American Security, a think tank in Washington.
"We don't know if a coup government would honor the agreement the U.S. worked out with Turkey" which has allowed the U.S. military to work with Kurdish militants in northern Syria to push back Islamic State fighters, Heras said. The Turkish military has fought against a Kurdish independence movement inside the country for years, and getting Turkish officials to allow the U.S. to arm and train Kurdish militants in northern Syria was a major diplomatic challenge. A new set of leaders in Turkey could upset that balance, Heras said.
"The ball would be in the court of the coup government, they would have to determine if they would continue," he said.
One major challenge will be whether the U.S. could continue to provide billions in military and counter-terrorism funding to Turkey under a new government. Under U.S. law, if a coup government took power, the U.S. wouldn't be able to provide military aid, Heras said.
"Turkey is the essential state in the counter ISIS fight on the ground," Heras said, using an acronym for Islamic State. Getting locked out of the Incirlik base would be a major setback in the U.S. effort against the militant group, he added.
Turkey has also been instrumental in absorbing the brunt refugees from Syria and Iraq. More than 3 million are believed to be living in Turkey, and many more cross its borders.
As such, Turkey's geographic position and its flexible government have served as something of an escape valve for besieged nations on both sides of the exodus.
Turkey also became the first Muslim country to recognize Israel. Turkey was long seen as a potential bridge between Israel and the Arab world and, more importantly, as a possible mediator in U.S.-led peace talks to end the conflict with Palestinians.
But Turkey-Israeli diplomatic relations broke down in 2010 after Israeli commandos killed nine Turkish activists aboard the Mavi Marmara protest flotilla that was seeking to break the Israeli naval blockade around the Gaza Strip. Turkey recalled its ambassador and downgraded diplomatic ties.
Despite efforts by the Obama administration to mend relations between its two most important allies in the region, tensions only began to lift recently with a June reconciliation agreement.
Through its history, geography both blessed and cursed Turkey. As the vast Ottoman Empire, what would become Turkey was for centuries a prosperous crossroads for merchants bearing silk and spices and other riches, flourishing under Suleiman the Magnificent in the 16th century.
And it was the site of brutal battles of conquest and territorial supremacy waged with Persia and the Christian armies of Spain and Venice.
Modern Turkey emerged from the ruins of the Ottoman Empire and the ashes of World War I. A nationalist leader named Mustafa Kemal, known as Ataturk, or "Father of the Turks," molded the nation, and its military, based on a staunchly secular Islamic faith and a deeply held Turkish national identity.
Erdogan's recent move toward a more prominent presence of Islam in Turkish life and in the government may have made the army increasingly nervous.
Staff writer Brian Bennett in Washington contributed to this report.
MORE WORLD NEWS
5:10 p.m.: The story was updated with more background.
4:14 p.m.: This story was updated with additional background and reaction.