Nigeria's Supreme Court has ruled that Vice-President Atiku Abubakar should be allowed to contest Saturday's presidential elections.
He was disqualified because of corruption allegations, which he said were politically motivated.
However, it is not clear if new ballot papers can be printed in time for Nigeria's 60m voters.
The ruling People's Democratic Party won a clear majority of the state governorship contests held on Saturday.
The Supreme Court judges unanimously ruled that the election commission did not have the power to disqualify candidates.
The strongest other opposition candidate has told the BBC he is not confident the election will be fair.
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 put the number at 50.
Nigeria is Africa's biggest oil producer but unrest in the oil-producing Niger Delta has cut output by some 20%.
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 has won in the south-eastern Abia State.
The Election Commission 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.
The presidential contest should see the first time one civilian administration hands power to another since Nigeria's independence from Britain in 1960.
President Olusegun Obasanjo is standing down after two terms in office.