Nigeria's Supreme Court has ruled that Vice-President Atiku Abubakar should be allowed to contest Saturday's presidential elections.
Mr Abubakar was a founder member of the ruling party
He was disqualified because of corruption allegations, which he says are politically motivated.
It is unclear if new ballot papers can be printed in time for the 60m voters.
The BBC's Alex Last says that after chaos and violence in Saturday's state elections, there are now fears for the credibility of the presidential poll.
The Supreme Court judges unanimously ruled that the election commission did not have the power to disqualify candidates.
Mr Abubakar's spokesman Shehu Garba was delighted with the ruling.
"It is a fantastic decision. It is a big relief to every lover of democracy in this land because this judgement is not for the vice-president alone," he said.
The ruling People's Democratic Party won a clear majority of Saturday's state governors' contests, but the ruling also raises questions about the validity of some these results, as the election commission had earlier disqualified several prominent candidates.
Our correspondent says it is possible that a sticker with Mr Abubakar's name could be added to the ballot papers.
Mr Abubakar was a founder member of the ruling People's Democratic Party (PDP) but fell out with President Olusegun Obasanjo last year when he opposed moves to let the president seek re-election.
Opposition supporters took to the streets in parts of the country on Sunday, claiming the results had been rigged.
Tension is said to be high in many Nigerian cities, with a curfew imposed in Kano and sporadic shooting heard in Lagos.
Opposition presidential candidate Muhammadu Buhari said election officials and police had been biased against his All Nigeria People's Party (ANPP) in seven states.
"To get whole states where the elections were not fair, and where there was violence, is quite disturbing," he told the BBC.
"The PDP stalwarts are organising thugs, carrying away boxes, diverting other election materials."
The police say that 21 people died in election clashes over the weekend, although local media report up to 50 dead.
Our reporter saw men storming a polling station and leaving with ballot papers in the southern city of Port Harcourt.
He says politicians often hire and arm young men to help them rig elections, attack rivals, steal ballot boxes and intimidate election officials or voters.
Political office is often seen as the quick path to real enrichment - a chance to tap into the country's huge oil revenues, especially in the oil-rich south of the country, our correspondent says.
Nigeria is Africa's biggest oil producer but unrest in the oil-producing Niger Delta has cut output by some 20%.
Winning from prison
The PDP has won 26 of the 32 states declared so far.
The ANPP has won the northern states of Bauchi, Borno, Yobe and Zamfara.
Mr Abubakar's Action Congress has retained control of the state of Lagos, the commercial capital and the small Progressive People's Alliance (PPA) has won in the south-eastern Abia State.
Victorious PPA candidate Theodore Orji is in prison on corruption charges.
The Independent National Election Commission (Inec) said two other south-eastern states - Imo and Enugu - will have to re-run their elections because of irregularities.
Results are still awaited from Kano and Taraba states.
The announcement of the results in the most populous state, Kano, was suspended amid high tension with both the PDP and ANPP declaring victory.
Opposition supporters burned down government buildings in northern Katsina State, after the PDP candidate was declared the victor.
The state election was cancelled in south-eastern Imo State because of election malpractice.
Mr Obasanjo said on state television that Saturday's vote had "gone on very well across the country."
The presidential contest should see the first time one civilian administration hands power to another since Nigeria's independence from Britain in 1960.
President Obasanjo is standing down after two terms in office.