Thousands of Turks have demonstrated in support of secularism during the funeral of the veteran statesman Bulent Ecevit in the capital Ankara.
"Turkey is secular and will remain secular," crowds chanted as his coffin reached the city's main mosque.
They also booed the arrival of Prime Minister Recep Tayyip Erdogan, whose party has its roots in political Islam.
Mr Ecevit, a staunch secularist, served as Turkish prime minister five times in a political career spanning 50 years.
He died last Sunday at the age of 81 after almost six months in a coma following a stroke.
He was probably best known for ordering Turkish troops into Cyprus in 1974 after a Greek-backed coup.
His funeral was moved from Wednesday to allow more people to attend and they began lining the streets from early on Saturday.
"People's Ecevit! Turkey is proud of you," chanted the mourners.
The crowd, some weeping, showered the hearse bearing his coffin with flowers, and many waved Turkish flags, banners and portraits of Mr Ecevit, a political force in the country for half a century.
Bulent Ecevit helped push Turkey towards the West
Around 10,000 police officers were on duty and closed roads for the funeral procession.
The square outside Ankara's biggest mosque was crammed full of people from all over Turkey, many with his photograph pinned to their chests.
When the funeral cortege arrived, the mourning turned into a political event and a show of support for the Turkish republic and the secular principles it was founded upon.
The president and military commanders were cheered but Mr Erdogan, whose party defeated Mr Ecevit four years ago, arrived at the funeral service to deafening boos and jeers.
Turkey's secular establishment has begun uttering stark warnings about an apparent surge in fundamentalism.
Mr Erdogan's government denies that it has an Islamic agenda and the prime minister has insisted his Justice and Development (AK) party is "working for the secular state to succeed".
Mr Ecevit was prime minister when the EU accepted Turkey as an accession candidate and when the Kurdish separatist leader Abdullah Ocalan was caught.
But his last years in office were beset by his own ill-health and an ailing economy.
His party suffered a landslide defeat in 2002, allowing the current government to sweep to power.
Following a change in the law made this week, Mr Ecevit was buried at the state cemetery in a western Ankara suburb, alongside the founders of the republic.