By DARLENE SUPERVILLE, Associated Press

WASHINGTON (AP) — President Barack Obama on Friday urged all sides in Turkey to support the democratically elected government of President Recep Tayyip Erdogan amid a military takeover of the key NATO ally.

In a statement issued after a meeting with his national security advisers, Obama also urged everyone in Turkey to show restraint and avoid violence or bloodshed.

Members of Turkey's armed forces declared hours earlier that they had taken control of the country as explosions, gunfire and a reported air battle between loyalist forces and supporters of the coup erupted in Ankara, the capital. Erdogan called on the Turkish people to flood the streets in a show of support for his embattled government.

Turkey plays a key role in the U.S.-led coalition fighting the Islamic State group. American jets use its Incirlik air base to fly missions against the extremists in Syria and Iraq.

Obama discussed the developments by telephone with Secretary of State John Kerry, who was traveling in Moscow for separate meetings with senior Russian officials on Syria.

In a separate statement, Kerry said the U.S. viewed the "very fluid situation" in Turkey with the "gravest concern."

Kerry said he had stressed in a telephone call with Turkish Foreign Minister Mevlut Cavusoglu the United States' "absolute support" for Turkey's democratically elected, civilian government and democratic institutions. Kerry said he urged all parties to ensure the safety and well-being of diplomatic missions, personnel and civilians across Turkey.

Kerry also urged U.S. citizens in Turkey to stay indoors and to be in touch with family and friends.

The Defense Department also released a statement saying it is "taking appropriate steps to ensure the safety and security of our service members, civilians, their families and our facilities."

The Pentagon said the coup attempt had so far made no impact on the Incirlik air base, and said anti-Islamic State air operations from Incirlik are continuing.

Democratic presidential candidate Hillary Clinton also weighed in Friday night. The former secretary of state echoed Kerry's remarks, saying, "We should all urge calm and respect for laws, institutions, and basic human rights and freedoms — and support for the democratically elected civilian government."