A Sri Lankan military court has convicted Sarath Fonseka, a former army chief, of meddling in politics while in uniform.
The media office of the presidency said on Friday that Fonseka's sentence of a dishonourable discharge is subject to approval by Mahinda Rajapaksa, the president.
If the president ratifies the ruling, the general will be stripped of his rank and military honours.
Fonseka, 59, was accused of trying to secure a place in a political party following talks with an opposition MP between October and November last year, just before he quit as chief of defence staff.
Leaked intelligence reports said Fonseka had tried to stage a military coup, an allegation he has denied.
Fonseka had been a close ally of Rajapaksa, and was key in the military's decisive victory over the Liberation Tigers of Tamil Eelam (LTTE) in 2009 after more than two decades of civil war.
He, however, fell out with Rajapaksa later and unsuccessfully ran against him in the January presidential election after quitting the army.
Fonseka was arrested soon after the presidential election that Rajapaksa won handsomely.
Al Jazeera's Minelle Fernandez, reporting from the capital Colombo, said: "During the end of the war last year in May we saw a lot of credit being given to Fonseka for his role in defeating the Tigers.
"However, just six months later Fonseka decided to take on Rajapaksa in the presidential elections. He was his main rival. And very soon things soured.
"It got very personal and bitter and shortly thereafter, we saw the general being charged and taken into military detention.
"His supporters maintain that this is very much a witch-hunt, that he is being punished and basically put in place for daring to take on the president.
"But the government has said this is purely a military action, that the court-martial must finish and come to its own verdict," our correspondent said.
'Miscarriage of justice'
Rienzie Arsecularatne, Fonseka's lawyer, denounced the verdict and said the case was heard in his absence during a court vacation. He said he would appeal the decision.
"They went ahead and fixed the court-martial on the days I was not available," Arsecularatne said.
"This is not a proper trial. This is a total miscarriage of justice."
Although Fonseka was in military custody during parliamentary elections in April, he won a seat in the legislature.
Maria Kuusisto, a Sri Lanka analyst from the Eurasia group, told Al Jazeera that Fonseka "emerged as a sort of one man opposition to President Rajapaksa over the past year or so".
While Friday's ruling carried no prison term, Fonseka will remain in military custody.
A separate court martial is still hearing charges that he engaged in corrupt deals. He also faces civilian charges of employing army deserters, an offence that carries a 20-year jail term.
Kuusisto said the arrest may be part of a larger plan.
"The ruling party is trying to consolidate their position in the parliament, particularly to gain a two-thirds majority, which would allow the president and the ruling party to change the constitution," she said.
"It is expected that constitutional changes would potentially boost the president's position even further."