Turkish President Recep Tayyip Erdogan has lashed out at Western leaders for failing to show solidarity with Ankara over a failed coup attempt, saying countries who worry more about the fate of the perpetrators than democracy cannot be Turkey's friends.

Inside Story - What will Turkey's failed coup mean for its relations?

Speaking at the presidential palace in Ankara late on Friday, Erdogan said Western leaders who were criticising the Turkish government's reaction to the July 15 coup attempt should "mind their own business".

"When five to 10 people die in a terror attack, you [Western countries] set the world on fire," he said.

"But when there is a coup attempt against the president of the Turkish Republic, who always protects the democratic parliamentary system and who was elected with 52 percent of the general vote, instead of siding with the government you side with the perpetrators."

Since the failed coup attempt, more than 18,000 people, including soldiers, judges, prosecutors and civil service workers, have been detained in Turkey.

Turkey: Witch-hunt or precautionary measures?

Of them, more than 8,000 have been charged, according to the latest interior ministry figures. Scores of media organisations have also been ordered to shut down

The rapid pace of arrests since the failed coup has worried many of Turkey's allies, with some saying they see the country, which is currently under a state of emergency, going down an increasingly authoritarian road.

Dropping of 'insult' lawsuits

During his speech at the presidential palace, Erdogan also announced that he was withdrawing, as a one-off gesture, all lawsuits filed against people for insulting him, a move he said was triggered by "feelings of unity against the coup attempt".

"I forgive them," he said.

Earlier on Friday, Erdogan also criticised the head of the US general command for suggesting that crackdowns in the Turkish military after the failed coup attempt had harmed the fight against the Islamic State of Iraq and the Levant (ISIL, also known as ISIS).

READ MORE: Turkey shuts scores of media outlets

"I am concerned that it will impact the level of cooperation and collaboration that we have with Turkey which has been excellent, frankly," General Joseph Votel said on Thursday, speaking at the Aspen Security Forum in Colorado, US.

WATCH: Erdogan calls on US to extradite cleric Gulen

"Know your place," Erdogan said in response on Friday, using one of his favourite expressions of anger.

“The US general [Joseph Votel] stands on the coup plotters' side with his words. He disclosed himself via his statements," Erdogan said, as he repeated calls for the US to extradite Fethullah Gulen, the Pennsylvania-based cleric and businessman blamed by Turkey for the coup attempt.

Following Erdogan's comments, Votel issued a statement denying he was supporting the coup plotters.

"Any reporting that I had anything to do with the recent unsuccessful coup attempt in Turkey is unfortunate and completely inaccurate," Votel said in his statement.

"Turkey has been an extraordinary and vital partner in the region for many years. We appreciate Turkey's continuing cooperation and look forward to our future partnership in the counter-ISIL fight."

Erdogan: Turkish democracy is not under threat (full version of the exclusive interview) - Talk to Al Jazeera

Source: Al Jazeera and agencies