Sierra Leone’s opposition candidate, Julius Maada Bio, has rushed to take his presidential oath in a hotel after winning the run-off election.
Mr Maada Bio is a former military ruler who briefly ruled the country in 1996.
He narrowly beat ruling party candidate Samura Kamara, who has alleged irregularities and says he will challenge the outcome in court.
Mr Maada Bio was sworn in on Wednesday, less than two hours after being declared the winner of Saturday’s vote.
“[This is] the dawn of a new era,” he said. “The people of this great nation have voted to take a new direction.”
Mr Maada Bio, leader of the Sierra Leone People’s Party (SLPP), won just under 52% of the vote.
He has already ruled the country, albeit briefly.
The 53-year-old was part of a group of soldiers who overthrew the government in 1992 when he was in his late 20s.
In January 1996, he staged a palace coup, arguing that his boss, Capt Valentine Strasser, wanted to renege on the promised handover to an elected civilian government.
His supporters point to that to call him the “father of democracy”.
But his critics cite human rights violations witnessed while he was in power, for which he has taken “collective responsibility”.
The outgoing president, Ernest Bai Koroma, stepped aside after serving two five-year terms for the All People’s Congress (APC). He had hand-picked Mr Kamara as his preferred successor.
Mr Maada Bio lost to Mr Koroma in the previous election.
A hard road ahead
By Umaru Fofana in Freetown
It has been a sometimes acrimonious campaign with the defeated candidate’s party accusing the electoral commission, foreign observers, civil society and journalists of being a part of an international conspiracy to hand the election to Mr Maada Bio.
Even with the country’s deep-rooted ethnic politics, tribalism came to the fore more prominently than ever before.
With a narrow outcome, the new president has vowed to heal the divisions, and build back the country’s broken educational system. He has a tough job ahead of him, made harder by the fact that his party has a minority in parliament.
Sierra Leone is one of the world’s poorest countries, with a fragile economy and widespread corruption.
It suffered heavily during a devastating Ebola outbreak in 2014. The disease killed nearly 4,000 people yet there are still only 200 doctors serving the country of seven million people.
Mr Maada Bio has promised to heal the country’s divisions and rebuild the country’s broken education system.