ANKARA (Reuters) - Hundreds of thousands of people marched in Turkey’s capital on Saturday to try to stop the ruling AK Party from picking Prime Minister Tayyip Erdogan as their presidential candidate because of his Islamist roots.

The AK Party has its background in political Islam, and the possibility of an Erdogan presidency after parliament votes in May has split this secular but predominantly Muslim country, which is engaged in membership talks with the European Union.

“Turkey is secular and will remain secular,” shouted protesters as they waved national flags and banners of Mustafa Kemal Ataturk, revered founder of the republic which separated religion and state.

A senior police official told Reuters that more than 300,000 people had attended the rally while the organizers, the Kemalist Thought Association, said the number exceeded 1 million. Some 10,000 police were on duty, but crowds were calm.

Tens of thousands of people were bussed into Ankara from across the country to attend the rally in Tandogan square, one of the biggest gatherings in recent years.

“This is the biggest political rally ever in Ankara,” said Deniz Baykal, leader of the main opposition Republican People’s Party.

Tens of thousands of people waving flags and clutching portraits of Ataturk later gathered at his mausoleum, a place where Turks seek solace in times of tension.

Thousands of pro-secularist Turks march to the Mausoleum of Mustafa Kemal Ataturk, founder of modern Turkey, in Ankara ahead of Turkey's presidential elections April 14, 2007. Around 300,000 Turks marched on Saturday to try to stop the ruling AK Party from picking Prime Minister Tayyip Erdogan as their presidential candidate next week because of his Islamist roots. REUTERS/Umit Bektas

The secular elite of generals, judges and university rectors fears Erdogan as president would try to undermine the strictly secular state.

They point to efforts by the AK Party to remove a ban on Islamic-style headscarves, expand Islamic teachings and appoint religiously minded members to top positions in the bureaucracy.

The AK Party has a big enough majority in parliament to elect Erdogan, or anybody else it chooses, to the seven-year post as head of state.

AK EXECUTIVE TO MEET

The party’s executive will meet to decide on their candidate on April 18, but senior AK Party member Egemen Bagis said he did not expect a final decision until around April 23. Parliament is due to vote in May.

“We’re warning the deputies in parliament. We’re worried that the secular character of Turkey will be removed if Erdogan or Bulent Arinc (AK Party member and parliament speaker) is elected president,” said Huseyin Ozen, a retired teacher.

Erdogan denies any Islamist agenda and says he has broken with his past and is now a conservative democrat. Erdogan, who has presided over strong economic growth and the launch of EU entry talks, has not confirmed whether he will run.

While he is Turkey’s most popular and charismatic politician, opinion polls suggest a majority of people in the country do not want him to become president.

“We’re here to defend the republic. We’re here to defend the women’s rights which Ataturk gave to us ... I hope Erdogan will not become president,” said 28-year-old shop owner Sanem Erdem.

Bagis, lawmaker and advisor to Erdogan, said the march was proof of democracy and freedom of expression in Turkey but it did not reflect the opinion of most Turks.

“Opinion polls today say the AK Party would get more votes than in the last election in 2002,” Bagis told Reuters.

Outgoing President Ahmet Necdet Sezer said on Friday the country’s secular system of government faced its gravest danger since the founding of the republic in 1923, in comments seen as a direct attack against the AK Party.

The stark warning from Sezer, ahead of polls that could give Turkey its first head of state with Islamist roots, came on the heels of similar remarks by the army chief on Thursday.

The army -- the most respected institution in Turkey according to opinion polls -- has ousted four governments from office in the past 50 years, most recently in 1997. It views itself as the ultimate protector of Turkey’s secular identity.