Profile: Sarath Fonseka
Over a career of four decades, Sarath Fonseka has been Sri Lanka's most high-profile and arguably its most tactically successful army officer. Prior to his release from jail in May 2012, he was also seen by some as one of the country's most high profile political prisoners.
Considered a war hero by many in Sri Lanka's majority Sinhalese community after leading the army to victory over Tamil Tiger rebels in 2009, he fell out with the government over who should take credit for the victory.
Mr Fonseka ran against the powerful incumbent, Mahinda Rajapaksa, in the January 2010 presidential elections but was resoundingly defeated. Shortly afterwards, he was arrested and charged with a variety of offences ranging from harbouring deserters to treason.
He remained defiant through court martial proceedings, even running for parliament while in detention.
In August 2010 he was found guilty of engaging in politics while on active service. He was given a 30-month jail term when a court martial the following month found him guilty of corruption in arms procurement deals. He was stripped of his rank and also relieved of his parliamentary seat.
But his most serious conviction was in November 2011 when he was found guilty of implicating the government in war crimes during the final phase of the conflict with the rebels. Mr Fonseka, who says he was misquoted in a newspaper article, was sentenced to three years in jail.
The former general and his supporters maintain that all of these charges are politically motivated.
Rights groups say that Mr Fonseka and President Rajapaksa are implicated in shooting Tamil fighters as they sought to surrender. Both men deny the allegations.
Soon after his release from two years in prison - he was mobbed by his adoring supporters as he left jail - Mr Fonseka argued strongly that Sri Lanka must co-operate with any international investigation into alleged war crimes.
He said some Sri Lankan leaders were "hiding their faces" over the conduct of the war, as if they were guilty. He denied allegations that thousands of civilians had been killed.Rivalry
Sarath Fonseka once told the BBC the "crowning achievement" of his military career was wiping out the rebels. He was nearly assassinated by a Tamil Tiger suicide bomber in 2006.
He was commissioned as a second lieutenant in June 1971 and rose through the ranks while completing training stints across South Asia and in the US and UK.
Over the years he acquired a reputation as a tough battlefield commander and was often in the thick of the action in fighting against the Tamil Tigers. He was wounded in action in 1993.
In the same year, as a colonel, he led a daring operation to relieve troops who at the time were under siege in Jaffna fort in the north of the country.
The man who is now Sri Lanka's Defence Secretary, Gotabhaya Rajapaksa, was with him during this operation.
The two men who worked so closely together later became bitter political adversaries. Gotabhaya Rajapaksa is one of President Rajapaksa's brothers.
In 1995 Gen Fonseka won widespread plaudits for his role in Operation Riviresa - the army's operation to capture Jaffna town from the Tamil Tigers.
One of the low points in his career was in 2000 when the strategically important Elephant Pass - one of the few land routes to the Jaffna peninsula - was overrun by hundreds of Tamil Tiger rebels in a surprise attack.
Troops commanded by Sarath Fonseka offered stiff resistance but ultimately had to withdraw. It was a setback that the general was determined to avenge - Elephant Pass was recaptured by his troops in January 2009.Bitter campaign
Like President Rajapaksa, the former general has made no secret of his ardent Sinhalese nationalism and has always displayed a willingness to speak his mind.
He pulled no punches in his criticisms of President Rajapaksa's election campaign, openly accusing him of creating a climate of intimidation and violence.
During the campaign, Mr Fonseka was able to ally himself with several minority Tamil and Muslim parties, despite earlier rhetoric which suggested that he was none too sympathetic towards their cause.
In 2009, for example, he told a Canadian newspaper that he "strongly believed that Sri Lanka belongs to the Sinhalese, but there are minority communities... they can live in this country with us. But they must not try to, under the pretext of being a minority, demand undue things".
But at the same time he made powerful enemies, alienating many of the country's top politicians. His detractors - and every government figure swiftly became one - said that he was plotting a coup, and that two court martial verdicts against him showed he was guilty of dabbling in politics while in uniform.
Now the former general is free, will any of Sri Lanka's varied opposition groups seek to adopt him once more as their standard-bearer?
Jehan Perera of the independent National Peace Council thinks Sarath Fonseka has momentum on his side.
"He is in a sense a wild card, an uncontrollable person. He is his own man. And he's a strong leader. And there is at this time in the country a sense that the opposition needs strong leadership."
On leaving prison the 61-year-old said he would "save" Sri Lanka and fight corruption - but it still not clear what role, if any, he might play in the future.
The BBC's Charles Haviland in Colombo says the question is whether Mr Fonseka will want to plunge fully back into politics - and whether the terms of his release allow this.