Abdullah Gul has been sworn in as Turkey's new president, following his election earlier in the day by the country's parliament.

The former foreign minister took the oath of office Tuesday and pledged neutrality between Turkey's secularists - including the military - and its more religious elements.

Gul, a devout Muslim, is Turkey's first president with a background in political Islam. However, he has pledged to uphold the nation's strong secular traditions separating government and religion.

He was elected Tuesday with 339 votes in the 550-seat parliament in a third round of voting, when only a simple majority was needed. Earlier this month, he failed to win the two-thirds majority needed for a victory in the first two rounds of voting.

European Commission President Jose Manuel Barroso welcomed the election of Gul, of the ruling Justice and Development Party. Barroso said it could help speed Turkey's bid to enter the EU.

Turkey's military chief warned Monday of threats to the country's traditions, vowing that the military will protect Turkey's secular and democratic structures.

General Yasar Buyukanit, head of the staunchly secularist military, said "centers of evil" are trying to undermine Turkish secularism. Turkish Prime Minister Recep Tayyip Erdogan has warned the military to stay out of politics.

Gul's wife wears an Islamic headscarf, which has been banned in Turkey's public offices and schools for nearly three decades.

Gul's nomination for president earlier this year sparked a political crisis in which thousands of secularists took to the streets to protest his candidacy.

Some information for this report was provided by AP and Reuters.