Malawi's constitutional court has annulled last year's controversial election, which saw President Peter Mutharika narrowly re-elected.
The judge found there had been widespread irregularities in the 21 May vote.
This is the first election to be legally challenged since Malawi's independence in 1964. A new vote will take place within 151 days.
There have been regular anti-government protests since the election.
The court ruled that Mr Mutharika will stay in power until a new election takes place.
Why was a legal challenge filed?
President Peter Mutharika won a second term in May with 38.6% of the vote.
But opposition candidates Lazarus Chakwera, who came second, and Saulos Chilima, who finished third, went to court to argue that the election was not fair.
They said the way the election was conducted was full of irregularities.
The judges, who arrived in court in the capital, Lilongwe, under military escort, upheld the complaint on Monday.
According to the official results, Mr Chakwera, who claims he won the election, garnered 35.4% of the vote as the flag bearer for the Malawi Congress Party.
Mr Chilima, a former ally of the president, got 20.2%. He was the candidate for the UTM.
There is a high level of anxiety in the country following months of tense clashes between the police and opposition supporters.
Many schools were closed and some public transport had been suspended ahead of Monday's court decision.
What were the irregularities?
In court, lawyers for the losing candidates said that correction fluid - known by the brand name Tipp-Ex - had been used on some of the tallying forms sent in by polling stations.
The changes were made after they had been signed by party agents, they said.
The lawyers also said that in some cases polling officials sent in the wrong copy of the results sheet to the main tallying centre.
They also found some mathematical errors in a small number of cases.
Though in each case there were not a huge number of errors, the lawyers said that the evidence pointed to a flawed process.
What was the response?
The Malawi Electoral Commission (MEC) defended its handling of the vote as being in keeping with the law.
It said that on the few forms where correction fluid had been found, it had not been used to change a result, but to alter procedural information that had been incorrectly entered.
The commission said it had not supplied the Tipp-Ex.
158,969Winning vote margin
The MEC's lawyers also argued that while the wrong copy of the results sheet had been submitted in some cases, that copy had been signed off by party agents and the tally itself was correct.
Outside the court proceedings, backers of Mr Mutharika's Democratic Progressive Party often mentioned reports of international observers, which were largely favourable, as evidence that he won the vote fairly.
What sort of coverage was there in Malawi?
The court proceedings, which lasted more than three months, were keenly followed.
Four radio stations broadcast the sessions live and on public transport passengers sometimes demanded that the radio be switched on so they could follow what was happening.
Groups of people gathered round radio sets to hear the latest from the court.
Why is it such a big deal?
The level of anger is unprecedented here.
Since the disputed results were announced last May, there have been regular anti-government protests. Some of these have resulted in looting and the destruction of property, including government offices.
Two people - one police officer and one civilian - are known to have been killed during the demonstrations.
Malawi's Human Rights Commission said that in October, during a security crackdown following a protest, police officers raped and sexually assaulted women, some of them in the presence of their children.
Just a few days ago, the country's anti-corruption body arrested a top businessman on allegations that he attempted to bribe the five judges hearing the case.
He allegedly wanted the judges to decide in favour of the respondents, Peter Mutharika and the Malawi Electoral Commission.
The businessman was reported to the anti-corruption agency by the chief justice.
The situation has not been helped by the fact that the police are not seen as neutral or professional. For the most part, it has been the military which has been going onto the streets to help bring order.