Ugandan opposition leader Kizza Besigye has told the BBC he has now been allowed to return home after saying hours earlier he had been barred.
Initially he said he was prevented from boarding a flight from Nairobi to Uganda after receiving medical treatment in Kenya.
The Ugandan government denied taking any action to block his return.
President Yoweri Museveni, who defeated Dr Besigye in February's election, is to be sworn in on Thursday.
Dr Besigye, who says the election was rigged, was violently arrested during a protest in Uganda two weeks ago and his eyesight was damaged by pepper spray.
He had told the BBC from Nairobi's Jomo Kenyatta international airport: "The Ugandan government had told the Kenya Airways chief executive that if they board us the aircraft will not be allowed to land in Uganda and that we were not welcome and that therefore they had absolutely nothing to do if they wanted to fly to Uganda but offload us."
Later he told the BBC that he had been given permission to return but could not say why the authorities had reversed their decision.
He said his wife had been negotiating with staff at the Kenya Airways office in Nairobi.
The BBC's Anne Mawathe at Nairobi airport says Dr Besigye is booked on a flight leaving at 1800 (1500 GMT).
Heavy security
Uganda's information minister, Kabakumba Matsiko, told the BBC the government had not told Kenya Airways to stop Dr Besigye from boarding its flight from Nairobi to Entebbe, outside Kampala.
"We were surprised when the FDC (Forum for Democratic Change - Dr Besigye's party) started spreading this rumour that the government had blocked Besigye from coming back," she told the BBC's Newshour programme.
Continue reading the main story
Ugandan women stage protest in Kampala over high prices - 9 May 2011
* Kizza Besigye in profile
* Would Museveni recognise his former self?
* Ugandan opposition sprayed pink
"The government has nothing to do with Besigye not coming to Uganda. We're waiting for Besigye to come back and all the preparations have been made."
She said all airlines had been told Dr Besigye was free to travel.
Whether the confusion was a misunderstanding or a ploy to disrupt the opposition's plans to welcome Dr Besigye home and to hold a rally is not clear, says the BBC's Will Ross in Kampala.
But the return of Dr Besigye in time for Mr Museveni's inauguration presents an awkward scenario, our correspondent adds, with the possibility of his supporters gathering in large numbers.
The security forces have been deployed in large numbers in Entebbe and along the 40km (25 mile) route into Kampala.
The opposition has planned another of its regular protests over high prices on Thursday.
Pink spray
In the last week, the opposition has stepped up its campaign over inflation, which has led to recent clashes between the police and protesters.
Kizza Besigye's car was attacked during a demonstration in Kampala on 28 April. He was doused in pepper spray and suffered injuries to his eyes as police arrested him.
Click to play
Advertisement
Opposition politician Olara Otunnu was one of those sprayed pink by police in Kampala on Tuesday
The following day, two people were killed and 90 injured when police fired bullets and tear gas at crowds protesting against Mr Besigye's arrest.
On Tuesday, opposition demonstrators were doused in pink liquid by police as they tried to hold a banned rally in Kampala.
President Museveni has said that, in an effort to curb riots, he wants a new law to deny bail for six months to those arrested while protesting.
Mr Museveni has been in power for 25 years and was re-elected to a fourth term in February in polls that Dr Besigye says were rigged.
The two used to be colleagues, with Dr Besigye serving as Mr Museveni's personal physician when they were in the bush fighting President Milton Obote's government in the early 1980s.
Dr Besigye had a role in government when Mr Museveni took power but they fell out about 10 years ago.
Dr Besigye left the country but returned in 2005 with the introduction of multi-party politics.