ISTANBUL (Reuters) - Turks, including the country's political leaders, paid their respects on Tuesday to former Prime Minister Necmettin Erbakan, the founder of the country's modern Islamist movement, who died on Sunday.
Sombre music poured from loudspeakers outside Istanbul's 15th Century Fatih Mosque and street vendors sold scarves emblazoned with the message "Mujahid Erbakan", celebrating the Erbakan as a holy warrior, as mourners chanted "Allahu Akbar", or "God is Great".
Prime Minister Tayyip Erdogan and President Abdullah Gul, proteges of Erbakan, joined other leaders for prayers in front of the coffin, laid out in the mosque's courtyard and draped in green cloth adorned with Koranic verses.
The streets, rooftops and balconies of houses surrounding the mosque were crammed with men wearing skull caps, and women, either veiled or wearing head scarves -- marks of respect. Some mourners carried Palestinian flags.
Mourners in the immediate vicinity of the mosque were in tens of thousands, though some media estimated the throng in hundreds of thousands.
"Erbakan was a genius," said 17-year-old student Talha Celik, as he tied a green ribbon with a Koranic inscription round his head. "Though they had their differences, Erdogan followed in his path."
Erbakan, who died of heart failure in an Ankara hospital aged 85, pioneered Islamist politics in Muslim but strictly secular Turkey and paved the way for the subsequent success of Erdogan's ruling conservative AK Party.
Erdogan's party, embracing pro-market policies and reforms designed to secure European Union membership, has gone on to dominate Turkish politics for the last decade, whereas Erbakan's party, staying close to his Islamist roots, had limited support.
Representatives of some 60 countries, including Egypt, India, Pakistan and Indonesia also attended the funeral.
Erbakan reached the pinnacle of his success in 1996 when he became the first Islamist prime minister in Turkey's modern history at the helm of a coalition government after his party won 1995 elections.
After a stormy year in government the powerful military forced him to resign, angry at what the generals saw as attempts to undermine the country's secular order and forge alliances in the Muslim world.
The country's top court banned Erbakan's Welfare Party in January 1998 for anti-constitutional activities, seizing its assets and banning Erbakan and other party members from politics for five years.
"The old regime did not tolerate him and closed his party. But he opened the way for the new generation," said Ali Sever, a 76-year-old man wearing a skull cap as he stood among mourners.
As military officers, including General Hayri Kivrikoglu, commander of the prestigious First Army, joined the congregation inside the mosque, members of Erbakan's party directed chants: "There is no God but God, Allahu Akbar."
With more than four million members, Welfare's support did not simply evaporate and the ban on Erbakan opened the way for Erdogan to rise to the fore of a new, more disciplined party that eschewed much of Welfare's more radical rhetoric.
Erbakan laid the foundations of the Islamist movement in the 1970s, building up a party that appealed to the conservative rural population and urban poor in a country where religion is officially excluded from political life.
He had also been banned from politics, along with other politicians, after a coup in 1980.
Remaining active in politics to the end, Erbakan had been re-elected head of the Islamist Saadet, or Felicity, Party last October after a power struggle within the party.
The Felicity Party has remained faithful to its Islamist ideas and gained 2.3 percent of the votes in the 2007 election.
The AK Party, which first came to power with a landslide victory in 2002, is expected to win its third successive term in power at a parliamentary election in June.
(Additional reporting by Ece Toksabay; Editing by Louise Ireland and Simon Cameron-Moore)