ISTANBUL -- The leader of Turkey's main opposition party completed his 25-day "March for Justice" from the capital Ankara to Istanbul Sunday and joined hundreds of thousands of supporters at a rally protesting a large-scale government crackdown on opponents.

Republican People's Party leader Kemal Kilicdaroglu launched the 280-mile march after a parliamentarian from his party was imprisoned in June. The march grew into a protest of the massive crackdown on people with alleged links to terror groups that began after a coup attempt last summer.

"If only there was no need for this march and there was democracy, media freedoms, if civic society groups could freely express their opinions," Kilicdaroglu told The Associated Press as he headed Friday into the final stretch of his marathon march.

Get Breaking News Delivered to Your Inbox

Once seen as feeble in his role as opposition leader, Kilicdaroglu has emerged as the voice of many Turks and been likened to India's Mahatma Gandhi, who led a nonviolent march against British colonial practices.

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, dubbed "Justice March", against the detention of the party's lawmaker Enis Berberoglu, in Istanbul, Turkey on July 9, 2017. Reuters/ Huseyin Aldemir

Tens of thousands of people have joined Kilicdaroglu throughout his march in scorching heat, chanting "rights, law, justice." Hundreds of thousands of people greeted Kilicdaroglu while waving Turkish flags and flags emblazoned with the word "justice."

Organizers said the weekslong event expressed "a collective, nonpartisan desire for an independent and fair judicial system" that they claim is lacking in Turkey. No party flags or slogans were allowed during the on the march.

The government has accused Kilicdaroglu of supporting terrorist groups through his protest. President Recep Tayyip Erdogan has said he is violating the law by attempting to influence the judiciary.

Turkey's definition of supporting terror is so broad that it has caused an impasse in the country's bid for European Union membership.

Parliament member Enis Berberoglu was sentenced last month to 25 years in prison for revealing state secrets for allegedly leaking footage to an opposition newspaper suggesting that Turkey's intelligence service had smuggled weapons to Islamist rebels in Syria.

In a New York Times op-ed Friday, Kilicdaroglu called the case against Berberoglu "the last straw in a series of antidemocratic moves" by Erdogan's government "targeting tens of thousands of Turkish citizens - politicians, journalists, academics, activists or ordinary citizens."

Following last year's failed coup, the government imposed a state of emergency leading to the arrest of more than 50,000 people and the dismissal of some 100,000 civil servants. A dozen lawmakers from the pro-Kurdish opposition party have also been jailed.

Ordinary citizens, sacked public employees and high-profile figures have joined Kilicdaroglu on his march. Novelist Asli Erdogan and leading Kurdish politician Ahmet Turk, both released from jail pending trial on various terror-related charges, as well as Yonca Sik, the wife of a prominent journalist currently in prison, were just a few.

Istanbul governor Vasip Sahin said 15,000 police officers were providing security at the post-march rally.

The U.S. Consulate issued a security message asking American citizens to exercise caution as "terrorists have targeted political rallies in the past, and that demonstrations and large events intended to be peaceful can turn confrontational and escalate into violence."