Obama: All parties in Turkey should support democratically-elected government

President Obama speaking live about the attack in Nice, France.

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.

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.