Elements of the Turkish military announced they had seized control of the country in a military coup on Saturday, sparking bloody clashes in Istanbul and Ankara.

An AFP photographer saw troops open fire on people gathered near one of the Bosphorus bridges in Istanbul and state-run news agency Anadolu reported that the parliament in Ankara has been bombed.

It was unclear who was in control of the strategic NATO country of 80 million people as tanks took to the streets and multiple explosions rang out in the country's two biggest cities.

Earlier in the night, a shaken President Recep Tayyip Erdogan appeared on television from an unknown location insisting he was still in power and vowing the putschists would pay a "very heavy price".

"I certainly believe that coup plotters will not succeed," he said, speaking on a mobile phone via FaceTime.

There was global alarm at the rapidly developing situation, as a presidential source said an F-16 fighter jet had shot down a helicopter hijacked by coup plotters.

State broadcaster TRT said the military had declared martial law and a curfew, in a statement signed by a group calling itself the "Council for Peace in the Homeland".

"The power in the country has been seized in its entirety," the statement said.

It said the coup had been launched "to ensure and restore constitutional order, democracy, human rights and freedoms and let the supremacy of the law in the country prevail, to restore order which was disrupted".

It was not yet clear whether the attempted takeover had been backed with the widespread support of the military, or just a few rogue elements within it.

Turkey's once-powerful military has long considered itself the guardian of the secular state founded by Mustafa Kemal Ataturk in 1923.

It has staged three coups since 1960 and forced out an Islamic government in 1997.

Erdogan's critics have long accused him of undermining modern Turkey's secular roots -- but the president was believed to have won control of the military after purging elements who opposed him.

- 'Turks are on fire' -
Erdogan said he was still president and Turkey's commander in chief, promising that plotters would pay a "very heavy price".

Looking pale and drawn as he spoke from what a presidential source said was a secure location, he urged people to take to the streets to resist the coup.

He blamed the events on "the parallel state" and "Pennsylvania" -- a reference to Pennsylvania-based cleric Fethullah Gulen, his arch-enemy who he has always accused of seeking to overthrow him.

He blamed the events on "the parallel state" and "Pennsylvania" -- a reference to Pennsylvania-based cleric Fethullah Gulen, his arch-enemy who he has always accused of seeking to overthrow him.

"I urge the Turkish people to convene at public squares and airports. I never believed in a power higher than the power of the people."

There was chaos in Istanbul as angry crowds took to the streets to boo the passing tanks, while others celebrated.

"We are angry at the military because they are killing us, they are killing civilians," one protester told AFP, asking not to be named.

But other Turks were welcoming news of the coup.

"Turks are on fire," Fethi Karabas, a 27-year-old tour guide in Taksim Square, told AFP.

"We have hope now," he added. "Turkey has been in a very polarised state for almost 15 years now... This is the manifestation of all that anger."

Rojhat Dogru, a Turkish Kurd on holiday in Istanbul, added: "I am very happy. Erdogan is a murderer but now he is dead."

- Global alarm -
Reports said that flights into Istanbul's main international airport had been halted. The Bosphorus bridges were closed in both directions and completely empty of traffic.

The coup plotters sought to reassure the international community, saying in their statement: "All our international agreements and commitments retain their validity."

It added: "We hope our good relations will continue with all countries in the world."

But there was a flood of concerned reactions from around the globe, with EU foreign policy chief Federica Mogherini calling for "restraint and respect for democratic institutions".

US President Barack Obama has been briefed, while the Kremlin said it was "deeply concerned" by the developments.

"Everything must be done to protect human lives," said a spokesman for German Chancellor Angela Merkel.

A Greek government source said Prime Minister Alexis Tsipras had been "briefed by the head of secret services" about the developments.