The former Sri Lankan army chief, Sarath Fonseka, has been freed after two years in prison.
Sri Lanka’s President Mahinda Rajapaksa signed the release order over the weekend, but legal formalities had to be completed before he could walk free.
He was arrested two years ago after standing against Mr Rajapaksa for the presidency when the two men fell out.
"I will devote my life [to] my people," he shouted as he emerged from Welikada jail said AFP news agency.
The former head of the Sri Lankan military was widely credited with the 2009 victory over Tamil Tiger rebels.
But Fonseka was jailed for corruption in 2010.
Earlier, Fonseka was mobbed by supporters as he left a hospital where he had been receiving treatment for a respiratory condition.
He then attended to legal formalities at the Supreme Court before returning to jail prior to being freed.
Sri Lanka marked the three-year anniversary of the end of the 26-year civil war at the weekend, and held a large military parade in the capital, Colombo.
The war began in the 1980s, with Tamils pressing for self-rule against a backdrop of an increasingly assertive Sinhalese nationalism.
(For updates you can share with your friends, follow TNN on Facebook and Twitter )