Turkish President Tayyip Erdogan told a rally of more than a million people in Istanbul that he would approve the death penalty if parliament voted for it, following last month's failed coup.

In a speech to the 'Democracy and Martyrs' rally, which was broadcast live on public screens across the country, Mr Erdogan said the network of US-based cleric Fethullah Gulen, who he blames for the coup attempt three weeks ago, must be destroyed within the framework of the law.

"If the nation makes such a decision (in support of death penalty), I believe political parties will abide by this decision," Mr Erdogan said during the unity rally in Yenikapi square in the tourist Sultanahmet district.

"It is the Turkish parliament that will decide on this (death penalty) given the sovereignty rests with the nation... I declare it in advance, I will approve the decision made by the parliament," Mr Erdogan said.

He attacked critics who said there was no death penalty in the EU, of which Turkey is a candidate nation, countering that capital punishment is used in the United States, Japan and China.

"Today there is the death penalty in the majority of the world," he said, adding that capital punishment had been legal in Turkey until 2004, though the last execution took place in 1984.

Mr Erdogan also criticised Germany for not allowing him a video link to a rally of his supporters there, and said pro-democracy rallies in Turkey would continue until Wednesday.

German authorities prevented Mr Erdogan from addressing a rally in Cologne last Sunday by video link, prompting Ankara to summon Germany's charge d'affaires.

Addressing today’s rally, Mr Erdogan said Germany had allowed Kurdish militants to broadcast via video conference.

"Where is the democracy?," Mr Erdogan said. "Let them nourish the terrorists, it will come back to hit them."

Meanwhile, Turkish Prime Minister Binali Yildirim told the rally that Mr Gulen would be brought to Turkey and pay the price for the coup attempt he is accused by the government of staging.

"Let all of you know, the leader of this terrorist group will come to Turkey and pay for what he did," Mr Yildirim said.

But he said the authorities would not be motivated by revenge and would act within the rule of law as they track down those responsible for the 15 July attempted coup.