Polls have closed in the Central African Republic where elections have been held to end years of conflict.
UN troops patrolled the capital Bangui to stop a repeat of the clashes seen during a recent referendum on a new constitution, but voting passed peacefully.
Thirty candidates vied to replace interim leader Catherine Samba-Panza.
CAR has been torn by sectarian violence since the largely Muslim Seleka rebel group seized power in March 2013.
A band of mostly Christian militias, called the anti-Balaka, then took up arms against the Seleka.
In January 2014, a transitional government was formed but elections have been postponed four times since February 2015 due to insecurity and logistical challenges.
Wednesday's voting passed with "no serious incidents" taking place, the commander of the UN peacekeeping forces in the country, Balla Keita, told AFP news agency.
Mrs Samba-Panza said that "many people believed the day (of elections) would not be possible because of insecurity" and organisational issues seen during a referendum held two weeks ago, which was marred by violence.
'We want to be free'
Three candidates are considered frontrunners for the presidency.
Two of them - Martin Ziguele and Anicet Dologuele - were prime ministers under late President Ange-Felix Patasse. The third, Karim Meckassoua, is a Muslim who served as a minister under President Francois Bozize until he was ousted in 2013 by Seleka rebels.
UN peacekeepers staged patrols and positioned armoured personnel carriers at polling stations in Bangui.
"I've been dreaming of this election for two years since the day armed men killed my father and my brother in Bangui. I voted for peace," said Ahmat Abouna, who fled to the Cameroon border town of Garoua-Boulai and voted along with thousands of other refugees, Reuters news agency reports.
Businessman Gradias Vara said: "We came to vote because we want to be free to get back to our professions. We want to put an end to the conflict."
Voting was extended at numerous polling stations where logistical problems had delayed voting, including in Bangui's flashpoint PK5 district, the AFP news agency reports.
The new head of the 11,000-strong UN force, General Bala Keita, said the atmosphere was "good-natured", and there had only been a few "administrative issues".
"It won't be like last time [the referendum vote]. We have learned, the people have learned, the saboteurs have learned. So we have all have learned. So today, God willing, all will go well," he told journalists in Bangui before polls closed.
Analysis: Abdourahmane Dia, BBC Afrique
Judging by the long queues in Bangui, it seemed that people were determined to turn the page on violence and division which they blame on rotten politicians driven by their own interests.
The same determination was seen during the 13 December referendum when many voters in Bangui's mainly Muslim PK5 district defied armed men who tried, and partly succeeded, to disrupt voting.
General Keita promised that troops would be more aggressive during the election, and said it was unacceptable that they could not help citizens fulfil their duty of voting when there were so many of them in CAR.
So the election is likely to be peaceful compared with the referendum, especially after a powerful Seleka leader, Nourredine Adam, backpedalled on his threat to disrupt voting in areas under his control following pressure from Muslim leaders.
The interim government and international donors pushed for the poll, believing that an elected president and parliament would help CAR, where most people are poor despite the fact that it is rich in resources, move forward.
But it is not going to be a perfect election, and if the poll is marred by widespread logistical problems and claims of vote-rigging, the post-election period will be difficult to manage.
Pope Francis ignored safety fears to visit CAR last month, and said Muslims and Christians were brothers and sisters who should live in peace.
Results are not expected for a few days. Observers say a second round is likely and could be held by the end of January.
Elections also took place for the 149-seat National Assembly.
After seizing power, the Seleka rebels installed Michel Djotodia as the first Muslim leader of the majority Christian country.
But under pressure from regional leaders and former colonial power France, Mr Djotodia stood down and was succeeded by Ms Samba-Panza.
All three former presidents were barred from contesting the election.
Mr Djotodia and Mr Bozize are both in exile and face UN and US sanctions over violence in the country.
Mr Bozize described the Constitutional Court's decision to reject his candidacy as "shameful".
About 1.8 million people were registered to vote, out of a population of roughly five million.
More than one million people have been forced to flee their homes because of the fighting.