Turkish army officers said they seized power in the country as warplanes flew over the capital and tanks blocked roads in Istanbul. Prime Minister Binali Yildirim said his government is still in control and will resist.

The military said in an e-mailed statement that it took power to restore freedom and democracy. It said all international agreements will be honored. It wasn’t clear whether the whole army was involved.

The state-run broadcaster appears to be in the control of the rebel officers and broadcast a declaration of martial law. It said the government had lost its legitimacy and been overthrown.

But elected officials said a faction of the army had illegitimately attempted to seize power and will be resisted. President Recep Tayyip Erdogan’s office said in an e-mailed statement that the army’s action wasn’t authorized by its top commanders. Erdogan’s own whereabouts weren’t immediately clear, but there was gunfire around his palace in the capital, Ankara.

Turkey’s lira plunged as much as 6 percent against the dollar, the most since 2010.

Since 1960, the NATO member has experienced at least three takeovers by the secular-minded army. But since the Islamist-rooted Ak Party government came to power in 2002, the political influence of the military has been trimmed.

The coup effort won’t be permitted to succeed and will be repulsed “very soon,” Yildirim told NTV television. He said army units have besieged “some institutions.” Police, traditionally closer to his government than the army, have been ordered to use arms if necessary.

CNN Turk television said that police fired at a military helicopter in Ankara. It wasn’t immediately clear how much of the country is under military control.

U.S. Secretary of State John Kerry said in Moscow that the U.S. hopes there will be peace and stability in Turkey.