People in the Central African Republic (CAR) have voted in an election overshadowed by violence between government and rebel forces.
President Faustin-Archange Touadéra is seeking a second term and has accused his predecessor, François Bozizé, of fomenting a coup with rebel groups.
The government rejected calls from the opposition to postpone the vote because of the insecurity.
In the run-up, three UN peacekeepers were killed by unidentified assailants.
The CAR is resource-rich but deeply unstable country that has seen several coups since independence from France 60 years ago.
The rebel groups, who have seized several towns close to the capital Bangui, had called on people not to vote.
Officials said that thousands of people did not receive their voter cards and correspondents note that the legitimacy of the result is likely to be questioned.
However the head of the UN mission in the country said that despite the closure of some polling stations, there was a large turnout in many areas.
2003Rebel leader and former army commander Francois Bozizé seizes power
2009UN Security Council agrees to creation of UN peace-building office for CAR to address ongoing insecurity
2013Bozizé flees into exile as Seleka rebel coalition rapidly overruns the country and takes control of the capital
2015Referendum on constitutional changes in November, followed by first round of presidential election
2019Bozizé returns to CAR
Ballots were cast in presidential and legislative races, with UN peacekeepers patrolling the capital, Bangui.
Mr Bozizé, who is barred from standing and is under UN sanctions, denies government claims that he is plotting a coup by backing the rebels' advance.
But shortly after voting started, he expressed support for the rebels, urging people not to vote.
Initial results are expected on 4 January. Sixteen candidates are running for president - including three women - and more than 1,500 contenders are running for the 140 seats that make up the National Assembly.
If no candidate gets more than 50% of the vote, a second round will take place on 14 February.
The UN on Friday condemned the killing of three of its peacekeepers as a possible war crime. It said two other peacekeepers were injured in the attacks, which took place in southern Bakouma and in Dekoa, in the centre of the country.
The CAR is one of Africa's poorest countries, even though it is rich in resources like diamonds and uranium. The UN, which has nearly 13,000 peacekeepers on the ground, estimates that half of the population are dependent on humanitarian assistance and up to a fifth have been displaced.
On 3 December the Constitutional Court ruled that Mr Bozizé did not satisfy the "good morality" requirement for candidates because of an international warrant and UN sanctions against him for alleged assassinations, torture and other crimes during his rule.
Mr Bozizé, a Christian, came to power after a coup in 2003 and subsequently won two elections that were widely seen as fraudulent. He was ousted in 2013 by the Séléka - a rebel coalition drawn largely from the Muslim minority - which accused him of breaking peace agreements.
The country has been wracked by waves of violence since then that President Touadéra, elected in 2016, has been unable to control.
Russia is allied with President Touadéra and this week said it had sent 300 military instructors to CAR, following a request for help from the government. Russia insists it is not involved in the fighting.