A pro-democracy rally in response to Turkey's failed coup attempt is being held in Istanbul, uniting the president, the prime minister and two opposition leaders on the same platform for the first time in years.

An estimated three million people, many waving the Turkish flag, attended the Sunday afternoon rally in Yenikapi square. 

Al Jazeera's Ayse Karabat, reporting from Istanbul, described the event as "the biggest, most crowded political meeting, in Turkish political history". 

READ MORE: Turkish political parties unite against coup attempt

As part of its anti-coup campaign, Ankara has been encouraging nightly rallies throughout the country, culminating in Sunday's grand finale.

The "Democracy and Martyrs' Rally" is meant to represent the unity of the country, with President Recep Tayyip Erdogan urging attendees to bring only the Turkish flag, instead of party banners.

"There we will stand together as a single nation, a single flag, a single motherland, a single state, a single spirit," he said before the rally.

Turkey failed coup: Standing up to the military

Around 13,000 people, in addition to police officers, will be on duty to run the event.

Helicopters, ambulances and over 700 medical personnel will also be on duty.

Similar rallies will also be held simultaneously across the country, according to officials from ruling Justice and Development Party (AKP).

HDP not invited

The rally will be attended by high-level officials.

Erdogan, Prime Minister Binali Yildirim, who is also the leader of the AKP, as well as the main opposition Republican People’s Party (CHP) leader Kemal Kilicdaroglu and Nationalist Movement Party (MHP) leader Devlet Bahceli were also expected to attend the rally.

Kilicdaroglu and Bahceli will address the rally before handing the stage to the prime minister and the president.

However, the pro-Kurdish People's Democracy Party's (HDP) co-leaders, Selahattin Demirtas and Figen Yuksekdag are not invited.

READ MORE: How could Turkey's failed coup affect the Kurdish peace process?

The HDP opposed the coup, but has been excluded because it allegedly supports the outlawed Kurdistan Workers' Party (PKK).

Turkey, the US and the European Union designate the PKK, an armed group that has been fighting for Kurdish autonomy since 1984, as a "terrorist organisation".

Erdogan has previously called for HDP members to be prosecuted, accusing them of being the PKK's political wing.

The HDP is the third-biggest party in parliament. It denies having direct links with the PKK and promotes a negotiated end to the Kurdish conflict, which claimed hundreds of lives since a peace process, once led by Erdogan and his governing party, collapsed in 2015.

As part of its anti-coup campaign, Ankara has been encouraging nightly anti-coup rallies throughout the country [EPA]

'One nation, one heart'

Prior to the rally, hashtags #birliktegucluyuz (Together we are strong) and #TekmilletTekyurek (One nation, one heart) were trending on Twitter, with thousands of people revelling in the solidarity between political parties.

On Sunday, almost all national Turkish newspapers, with different political inclinations, also called for unity and invited their readers to attend the joint rally in Yenikapi square.

The failed coup attempt by a small faction of the Turkish military on July 15 killed more than 270 people and posed the gravest threat yet to Erdogan's 13 years in power.

Loyalist factions in the security forces, with the help of thousands of Turkish citizens who took to the streets, quickly put down the coup attempt.

US based cleric and businessman Fethullah Gulen, a former Erdogan ally, has been blamed for the coup attempt.

Since July 15, more than 70,000 people in the military, judiciary, civil service and education have been detained or suspended for alleged links to Gulen's movement. 

Turkey: From failed coup to media crackdown - The Listening Post

Source: Al Jazeera and agencies