Ghana's Supreme Court on Thursday upheld President John Dramani Mahama's win in elections last year, dismissing the opposition's case alleging voter fraud in a test for one of Africa's most stable democracies.
The decision ended a months-long saga that had riveted the west African nation of 25 million people seen as a rare beacon of democracy in the turbulent region.
Shortly after the ruling was announced, opposition leader Nana Akufo-Addo conceded defeat and said he would not seek further review of the decision.
Mahama appeared on national television on Thursday evening and spoke of moving forward.
"The political maturity with which we have received the verdict announced today by the supreme court, coupled with our ever-present patriotism, will ensure that Ghana is the ultimate winner, not any one individual or political party," he said.
"Strong institutions are the bedrock of strong nations."
In the December polls, Ghana's electoral commission said Mahama took 50.7 percent of the vote over ex-foreign minister Akufo-Addo's 47.7 percent.
"The first respondent (Mahama) was validly elected and the petition is therefore dismissed," presiding judge William Atuguba said, reading from the verdict issued by the nine-justice panel.
The sometimes tense proceedings were broadcast live on radio and television and were followed closely across the nation.
A heavy police presence deployed around the court ahead of the ruling, with access to the chamber tightly restricted.
After the decision was announced, opposition NPP supporters quickly filed out, while the president's loyalists waved party flags and cheered. There were no immediate reports of trouble.
While observers had broadly declared the vote fair, the NPP levelled an array of allegations, including that tally sheets had been doctored and ballot boxes stuffed.
Some of the judges found merit in certain NPP allegations, but as a group they declared Mahama's win legitimate.
"Whilst I do not agree with the court's decision, I accept it," Akufo-Addo told journalists at his home in the capital Accra as dozens of supporters gathered outside.
"We shall not be asking for a review," he said, adding that he had spoken to Mahama and congratulated him.
Hundreds gathered to celebrate outside the headquarters of Mahama's NDC party.
The 2012 elections were generally unmarred by violence and many in Ghana are wary of the type of bloody unrest seen after recent elections in Nigeria or neighbouring Ivory Coast.
There had been widespread calls for restraint ahead of the court's decision.
Everything from the conduct of the lawyers and witnesses to the quality of the evidence had been debated on the airwaves and written about in Ghana's feisty press.
In June, irate judges declared that anyone making disparaging public statements about the court could be held in contempt.
Those who ran afoul of the order were kicked out of the courtroom, fined, or, in a few cases, jailed.
Editor of the Daily Searchlight newspaper Ken Kuranchie was jailed for 10 days in July for contempt after publicly criticising the judges.
The jailing sparked debate over Ghana's contempt laws, many of which date back to British colonial rule.
Before the ruling, Franklin Cudjoe, director of the IMANI think-tank in the capital Accra said "Ghana's elections will never be the same again."
He also praised the court's willingness to spend months hearing the case.
Ghana is west Africa's second-largest economy, thanks to exports of gold and cocoa along with a nascent oil industry, which began production in 2010.
Since 1992, the country has held six multi-party elections in a region where democracy remains fleeting for many.
Mahama's successful campaign was built around his promise to continue the work of President John Atta Mills, his predecessor, who died in office in July 2012. Mahama, who was vice president at the time, took over after Mills's death.
Akufo-Addo campaigned on a platform that centred on a promise of free high school for all, which critics said the country could not afford.