ISTANBUL - Turkey has sacked almost 9,000 officials in its relentless crackdown against suspected coup plotters, authorities said Monday, as the former air force chief denied masterminding the weekend's failed putsch.

With Western allies expressing alarm over fears Ankara that could reinstate the death penalty in response to Friday's dramatic coup bid, General Akin Ozturk appeared in court, looking haggard and with his ear bandaged.

"I am not the person who planned or led the coup. Who planned it and directed it I do not know," state-run news agency Anadolu quoted him as saying in his statement to prosecutors.

Turkish President Recep Tayyip Erdogan has vowed to wipe out the "virus" of the putschists, whose attempted power grab left more than 300 people dead. But the United States, European Union and United Nations have sternly warned him against excessive retribution as authorities round up the alleged perpetrators.

German Chancellor Angela Merkel's spokesman denounced "revolting scenes of caprice and revenge against soldiers on the streets" after disturbing pictures emerged of the treatment of some detained suspects.

Prime Minister Binali Yildirim said over 7,500 people have been detained, including 103 generals and admirals, over the coup bid which Erdogan has blamed on his arch-foe, the US-based preacher Fethullah Gulen. The interior ministry said almost 9,000 people, including almost 8,000 police but also municipal governors and other officials, had also been dismissed in a widening purge.

Early Monday, special Istanbul anti-terror police units raided the prestigious air force military academy, detaining four suspects, Anadolu reported. Authorities have also detained General Mehmet Disli, who conducted the operation to capture chief-of-staff Hulusi Akar during the coup, an official said.

With Turkey's big cities still on edge, Turkish security forces killed an armed attacker who shot at them from a vehicle outside the Ankara courthouse where suspected coup plotters were appearing before judges.

Western leaders have pushed Turkey to follow the rule of law as the massive retaliatory purge adds to existing concerns about human rights and democracy in the strategic NATO country. "We also urge the government of Turkey to uphold the highest standards of respect for the nation's democratic institutions," US Secretary of State John Kerry told reporters after talks with EU foreign ministers.

The Council of Europe joined the criticism, with its panel of constitutional experts saying: "Arrests and mass sackings of judges are not an acceptable way of restoring democracy."

Prime Minister Yildirim said the plotters would be brought to account but Turkey would "act within the law".

But Erdogan added fuel to the fire, reiterating that bringing back the death penalty is not off the table for the coup plotters. "There is a clear crime of treason," Erdogan told CNN in his first media interview since the chaotic events of Friday night. "The leaders will have to come together and discuss it. If they accept to discuss it, as the president, I will approve any decision to come out of the parliament."

Turkey abolished the death penalty in 2004 as part of its long-running efforts to join the EU -- and the bloc's foreign affairs chief Federica Mogherini responded bluntly to the suggestion it could be reinstated. "Let me be very clear," she said. "No country can become an EU state if it introduces the death penalty."

The US on Monday lifted restrictions on flights to Turkey that had been imposed in the wake of the coup. Meanwhile, a Greek court will Thursday decide the fate of eight Turkish military officers who fled across the border by helicopter after the coup, with Ankara seeking their extradition.

The turbulence has raised concern about the stability of Turkey, which is part of the international coalition fighting Islamic State jihadists in Syria. It has also hit financial markets, with the lira at one point losing five percent in value against the dollar although it rallied slightly Monday. Ankara has demanded that Washington extradite Gulen, but Kerry said he had urged his Turkish counterpart Mevlut Cavusoglu to "send us evidence, not allegations".

The preacher's followers have a powerful presence in Turkish society, including the media, police and judiciary, and Erdogan has long accused him of running a "parallel state" in Turkey. But the 75-year-old has categorically denied any involvement in the plot and suggested it could have been staged by Erdogan himself.

In another development, police on Monday detained seven soldiers after searching the key Incirlik air base in southern Turkey used by the US for air raids on IS jihadists, Anadolu reported.