Sri Lanka's President Mahinda Rajapakse has ordered the release of the jailed former army chief, Sarath Fonseka.
A presidential spokesman told the BBC he would be freed on Monday after formalities were completed.
Mr Fonseka was arrested two years ago after standing against Mr Rajapakse for the presidency.
The former head of the Sri Lankan military was widely credited with the 2009 victory over the Tamil Tigers.
Sri Lanka has been marking the three-year anniversary of the end of the 26-year civil war this weekend, and held a large military parade in the capital, Colombo, on Saturday.
Mr Fonseka was jailed for corruption in 2010.
A parliamentarian and aide to Mr Fonseka, Tiran Alles, told the BBC that he was likely to walk free on Monday, which is also the day that doctors say he can be discharged from the hospital.
Mr Fonseka has been receiving treatment for a respiratory problem.
Sri Lanka's foreign minister is currently in Washington and has been meeting US Secretary of State Hillary Clinton to try and fend off allegations of war crimes.
The BBC's Charles Haviland in Colombo says that although the US calls Mr Fonseka a political prisoner, once he is free he could find himself scrutinised just as much on human rights issues as the country's political leaders with whom he fell out dramatically.
On Friday, a leader of the university students' union in the Tamil-dominated town of Jaffna was beaten with iron bars as he attended a memorial event for the thousands of civilians believed to have died in the final months of the war.
In the past, the government has banned several similar memorials.
And R Sampanthan, leader of the main Tamil party, said the "triumphalism" over the war should end.
"The LTTE [Tamil Tigers] has been defeated. That is the reality that everybody knows. And celebrating a military victory year after year is not going to be helpful from the point of view of reconciliation," he said.
Sri Lanka's civil war began in the 1980s, with Tamils pressing for self-rule against a backdrop of an increasingly assertive Sinhalese nationalism.
Most of the fighting took place in the Tamil-dominated north, but the Tamil Tigers, or LTTE, also carried out suicide bombings in Colombo in the 1990s.
The violence killed up to 100,000 people over several decades, with accusations that both sides in the conflict committed war crimes against civilians.