Sierra Leone's opposition challenger Julius Maada Bio has secured his first term in office as a civilian when he was declared the winner of a controversial presidential run-off - but his opponent vowed to contest the result.
Bio, a former soldier who briefly led a military junta more than two decades ago, won 51.81 per cent of ballots in last month's election, according to official results.
He beat Samura Kamara, who secured 48.19 per cent of the vote, ending a decade in power for Kamara's All Peoples' Congress (APC) in the poor West African nation.
Cheers and songs erupted among thousands of Bio's supporters who were gathered in the capital Freetown on Wednesday evening. Shortly after the announcement, Bio was sworn in as president, handed a symbolic command baton by the country's top judge.
But hopes for a smooth transition were soon thrown into doubt after Kamara said he was rejecting the National Election Commission's results.
"We dispute the results and we will take legal action to correct them," Kamara said in a televised address, calling on his supporters to stay calm.
The results, he added, "do not reflect the party's many concerns about massive ballot box stuffing, supernumerary votes, and other irregularities."
The official results of the vote had been delayed by a dispute over the method of tallying that left ballot papers from 11,000 polling stations uncounted.
The campaign was characterised by ugly verbal exchanges and sporadic violence with Bio accusing the APC of using police intimidation against his party.
Police reported a string of attacks on candidates and supporters on both sides since the first round on March 7 - which Bio narrowly won - after which Kamara declared that "the safety and security of Sierra Leone is in our hands".
Bio, a straight-talking retired brigadier, has blasted the government's closeness to China, while Kamara had presented himself as a continuity candidate.
Although international observers reported some "issues" during the March 31 second round that saw heightened security measures, the monitors declared themselves "satisfied" with the overall conduct of the poll.
Earlier, Kamara supporters marched in Freetown, tearing down Bio posters and alleging "foreign meddling" in the vote, an AFP reporter said.
Security forces erected a cordon around Bio's SLPP party headquarters, where hundreds of supporters had already begun celebrating victory ahead of the expected official results.
A total of 3.1 million people were registered to vote in the first presidential poll since a 2014-2016 Ebola outbreak that killed 4,000 people.
Kamara's term was also marred by a mudslide that struck Freetown last year, killing hundreds of people.
One of the world's poorest nations despite huge mineral and diamond deposits, Sierra Leone is recovering only gradually from war and disease. Its economy remains fragile, with corruption widespread in the former British colony.
Political loyalties are often divided along ethnic lines and traumatic memories of the 1991-2002 civil war run deep.
Bio was in a group of young soldiers behind a 1992 coup that would install their leader, Valentine Strasser, as the youngest head of state in the world, at age 25.
He later took power but agreed to step aside in 1996 for an elected civilian leader, and his subsequent apologies for his role in the junta appear to have rehabilitated his image.