Nigerian President Olusegun Obasanjo's re-election faces the double test of a legal challenge and fears of organised violence at next week's inauguration.
On Tuesday, opposition leader Muhammadu Buhari filed a legal challenge at the Court of Appeal in Abuja claiming that Obasanjo was ineligible for office and that his re-election had been rigged and illegal.
"We are saying that the entire election should be nullified," Buhari's lawyer Mike Ahamba said. "Obasanjo is not qualified to contest the election, he has been head of state twice before."
Under Nigeria's constitution no elected president can serve more than two terms in office.
Obasanjo was Nigeria's unelected military ruler between 1976 and 1979 and was elected as civilian president in 1999. Buhari has also seized power from a civilian government in 1983 and ruled as a military leader for 20 months.
No date was set by the court for consideration of Buhari's complaint, but it follows two similar legal challenges lodged by much smaller opposition groups, alleging Obasanjo was not "validly elected".
The legal challenge came as police said some groups are planning massive anti-government demonstrations to ensure disruption of the May 29 inauguration.
"We are even told that some people have gone as far as manufacturing explosives with the aim of using same to cause panic and making the country generally ungovernable," Inspector General Tafa Balogun said in a statement.
He did not name which group was behind the alleged plot and made no mention of any arrests.
Balogun emphasised that any protests would be illegal unless they had police authorisation.
"Any individual or group of people who convenes a public rally or procession without a police permit is contravening the law and will be arrested, detained and prosecuted," he said.
A spokesman for Buhari's All Nigeria People's Party said it was only planning peaceful protests and that the party would seek permission for their protests.
"We will try to act within the law," said ANPP spokesman Sam Nda-Isaiah, "but one thing is clear, we are not going to allow the stifling of our case."
The legal challenge, coupled with suspected disruptions at an inauguration, may increase tensions in Africa's most populous country.
Security forces are likely to be on a heightened state of alert as 47 heads of state arrive to attend the president's second inauguration ceremony.
Demonstrations can easily turn violent in Nigeria. Amnesty International estimates that around 10,000 people have been killed in mob violence since Obasanjo came to power in 1999.