The Turkish government has rounded up thousands of alleged military plotters and judges following the attempted coup d'etat against President Recep Tayyip Erdogan. Some 2,839 military personnel – including the general of the Second Army which protects the country's borders with Syria, Iraq and Iran – were arrested in the wake of the failed plot, according to state-run Anadolu news agency.

Nearly 3,000 judges and prosecutors have been suspended and detained for suspected ties to US-based cleric Fethullah Gulen. They reportedly include a member of the country's top court.

Thousands of people took to the streets of Ankara and Istanbul overnight on 16 July in celebration of the government's victory – less than 24 hours after they heeded Erdogan's call to march against the coup plotters.

A total of 265 people were killed and more than 1,400 people injured in the coup attempt, which rocked Turkey's two main cities on 16 July. Erdogan accused Gulen of inspiring the uprising but the cleric – who has resided in self-imposed exile in Pennsylvania since 1999 – has denied it.

"I condemn, in the strongest terms, the attempted military coup in Turkey," Gulen was quoted as saying by NBC News. "Government should be won through a process of free and fair elections, not force. "As someone who suffered under multiple military coups during the past five decades, it is especially insulting to be accused of having any link to such an attempt. I categorically deny such accusations."

Istanbul, Turkey
Thousands of people marched in support of Erdogan in Istanbul following the coup attempt Reuters

Reuters reported that the mass detainments of soldiers have led to police stations overflowing in the capital city Ankara. Footage captured by the agency shows some soldiers handcuffed, stripped from the waist up and sitting on the floor of a bus, waiting to be driven under police escort to a sports stadium.

US President Barack Obama has called on Turkish authorities to exercise restraint and follow the rule of law during its crackdown on the coup plotters.