The former speaker of Niger's parliament, Hama Amadou, will not be released from prison to campaign for elections, Niger's court of appeals has said.
Mr Amadou was arrested in November 2015 for baby-trafficking charges after fleeing to France for a year.
He filed for provisional release to run in the elections but Judge Ibrahim Harouna denied the appeal on Monday.
Mr Amadou says the accusations against him are politically motivated.
The Constitutional Court on Saturday approved him to stand in elections. The court of appeals did not give a reason for the verdict.
Mr Amadou's second wife was arrested in June 2014 along with 16 others, accused of illegally buying new-borns from "baby factories" in south-east Nigeria - where babies are allegedly sold for thousands of dollars. All denied any wrongdoing.
Mr Amadou - a leading opposition presidential candidate - was then arrested in November 2015 after living in exile in France.
Mr Amadou's supporters say the charges were fabricated to prevent him from running against President Mahamadou Issouffou in the 21 February presidential election.
"With this rejection of conditional release, the regime succeeded with its first knock-out blow," his lawyer, Souley Oumara, said.
The BBC's Abdourahmane Dia says that Mr Amadou now has five days to appeal against the decision - or risk following the election from his prison cell.
Tensions have been rising in Niger ahead of the elections. On Monday, lawyers in the country staged a 24-hour strike to oppose what they call the arbitrary arrest of government opponents.
In December, President Mahamadou Issoufou said his government had foiled a plot to overthrow him.
He is the favourite to win elections, though critics accuse him of becoming increasingly authoritarian as the vote nears.
The campaign for the presidential election is due to start on 31 January, with 15 candidates vying for the presidency.