Republican People's Party (CHP) chief Kemal Kilicdaroglu was set upon by an angry crowd while attending a memorial on Sunday.
Footage shows him being pushed and shoved in the melee, with some in the crowd attempting to land blows.Escorted by security forces, he took shelter in a nearby house until the crowd dispersed.
Mr Kilicdaroglu had attended the funeral to pay respects to a Turkish solider who was killed in clashes with Kurdish PKK militants near the border with Iraq.
But what started as a protest against Mr Kilicdaroglu's presence descended into violence against him, according to Anadolu state news agency.
The CHP confirmed Mr Kılıçdaroğlu had been attacked but it was not immediately clear if he had been injured.
Speaking to AFP news agency, his party later said Mr Kilicdaroglu "is fine" while his office said legal action would be taken "against the culprits of the incident".
President Recep Tayyip Erdogan's ruling AKP party and nationalist politicians have criticised Mr Kilicdaroglu for his connections with pro-Kurdish party, HDP.They have accused him of cooperating with the HDP, which the government has linked to Kurdish militants. HDP denies any links to militants.
Tensions have risen in Turkey since the CHP won Ankara and Istanbul in mayoral elections, delivering a blow to Mr Erdogan's AKP party.
Alleging irregularities with the vote, Mr Erodgan has challenged the slim opposition victory for the CHP's mayoral candidate for Istanbul, Ekrem Imamoglu.
A recount by election authorities determined that Mr Imamoglu had won the election by around 13,000 votes, granting him his mandate.
The AKP, which has been criticised for fuelling partisan tensions, had won every election since coming to power in 2002.
On the campaign trail, Mr Erdogan said the municipal votes were about the "survival" of Turkey and his party