Turkish President Recep Tayyip Erdogan on Sunday gave signals that Turkey might reinstate capital punishment in the wake of Friday's failed coup attempt.

Erdogan spoke to his supporters in front of his Istanbul home Sunday evening. His speech was punctuated by frequent calls of "we want the death penalty" from the large crowd, to which Erdogan responded: "We hear your request. In a democracy, whatever the people want they will get."

The Turkish president said government officials would be in contact with Turkey's opposition parties to reach a position on capital punishment, adding, "We will not delay this decision for long. Because those who attempt a coup in this country must pay."

Turkey hasn't executed anyone since 1984 and capital punishment was legally abolished in 2004 as part of its bid to join the European Union.

The Turkish government also accelerated its crackdown on alleged plotters of the failed coup, with Justice Minister Bekir Bozdag saying Sunday that 6,000 people had been detained in the investigation, including three of the country's top generals and hundreds of soldiers.

In addition, dozens of arrest warrants were issued for judges and prosecutors deemed to be government opponents.

The government also dismissed nearly 3,000 judges and prosecutors from their posts, while investigators were preparing court cases to send the conspirators to trial on charges of attempting to overthrow the government.

"The cleansing (operation) is continuing. Some 6,000 detentions have taken place. The number could surpass 6,000," Bozdag said in televised comments.

Authorities issued a warrant for the arrest of President Recep Tayyip Erdogan's top military aide, Col. Ali Yazici, a U.S. official told Fox News. It wasn't immediately clear what role, if any, Yazici played in the attempted coup that started late Friday.

The botched coup, which saw warplanes fly over key government installations and tanks roll up in major cities, ended hours later when loyal government forces regained control of the military and civilians took to the streets in support of Erdogan.

Chanting, dancing and waving flags, tens of thousands of Turks marched through the streets into the early hours Sunday in half a dozen cities after officials urged them to defend democracy and back Erdogan, Turkey's top politician for 13 years.

It was an emotional display by Turks, who rallied in headscarves and long dresses, T-shirts and work boots, some walking hand-in-hand with their children. Rather than toppling him, the attempted coup that left some 265 dead and 1,440 wounded appears to have bolstered Erdogan's popularity and grip on power.

The Yeni Safak newspaper used the headline "Traitors of the country," while the Hurriyet newspaper declared "Democracy's victory."

"Just a small group from Turkish armed forces stood up against our government ... but we, the Turkish nation, stand together and repulse it back," Gozde Kurt, a 16-year-old student at the rally in Istanbul, said Sunday morning.

Gen. Umit Dunda said the dead included at least 104 conspirators, describing them as mainly officers from the Air Force, the military police and armored units.

The Associated Press contributed to this report.