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 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.
A statement issued on the president's Twitter account said, "the Supreme Court has spoken and validated our Dec2012 victory.... This is a victory for Ghana's democracy."
The sometimes tense proceedings were broadcast live on radio and television and were followed closely across the nation of 25 million people.
In the December polls, Ghana's electoral commission said Mahama took 50.7 percent of the vote over NPP candidate Nana Akufo-Addo's 47.7 percent.
A heavy police presence deployed around the court ahead of the ruling, with access to the chamber tightly restricted.
After the decision was announced, NPP supporters quickly filed out, while the president's loyalists waved party flags and cheered.
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.
Both parties had said beforehand that they would accept the court's ruling, though under Ghana's laws, Supreme Court rulings are subject to review.
The 2012 elections were generally unmarred by violence and Ghana has been seen as a rare democratic success story in turbulent west Africa.
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 from politicians and religious leaders 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.
Akufo-Addo, who was in court to hear the decision but left immediately after the ruling was read, was expected to react later Thursday.