A march against the government of Recep Tayyip Erdogan starting from the Turkish capital Ankara has ended with tens of thousands of people gathering in the country's biggest city Istanbul.

The action was launched by the leader of the Republican People's Party, Kemal Kilicdaroglu in opposition to a crackdown on people accused of links with terror groups.

The 450km march which started on 15 June is the biggest display of defiance against the Turkish government for four years, since protests in Gezi Park.

Kilicdaroglu launched the march after one of his MPs, Enis Berberoglu, was detained on claims of leaking documents apparently showing that the government was arming jihadists in Syria.

"Why did we march? We walked for the non-existent justice. We walked for the rights of the oppressed, for the imprisoned lawmakers, the jailed journalists... We walked for the academics who were thrown out of universities," Kilicdaroglu told the rally, according to the Associated Press.

Turkish march
People wave Turkish flags during a rally to mark the end of the main opposition Republican People's Party (CHP) leader Kemal Kilicdaroglu's 25-day long protest. Reuters

After a failed coup attempt in 2016, there have been more than 50,000 people arrested and 140,000 people dismissed during a state of emergency, which has been condemned by the international community.

Tens of thousands of people joined the 25-day march, with many chanting "rights, law, justice".

"No one should think the end of this march is the end. This march was our first step," Kilicdaroglu said. "July 9 is a new step. July 9 is a new climate. July 9 is a new history."

However, the Turkish government accuses Kilicdaroglu of supporting terror groups and unlawful behaviour for his exhortations to the judiciary not to be swayed by political pressure.

US Secretary of State Rex Tillerson arrived in Istanbul on Sunday to meet with Erdogan and the Turkish foreign minister. He was also in the city to receive an oil industry award.