The high court agreed with the attorney general's argument that General Sarath Fonseka should not be released because military proceedings were continuing against him.

The court did grant permission for Fonseka's family and lawyers to visit him in custody, and to take measures to ensure his safety.

Fonseka led the final military offensive that defeated the rebels of the Liberation Tigers of Tamil Eelam in May.

Two weeks after the war ended, the commander was demoted to the largely ceremonial post of chief of defense staff, leading to a fallout with President Mahinda Rajapaksa.

Fonseka decided to enter politics and contested the Jan. 26 presidential elections as an opposition candidate. He received 40 per cent of the vote against Rajapaksa, who won a second term with 58 per cent.

Soldiers arrested Fonseka on Feb. 8, allegedly for having shared sensitive military information with the opposition while serving as army commander and chief of staff. His lawyers and relatives have denied the allegations on his behalf.

One of the key opposition parties in the country is also planning to field Fonseka as one of their candidates in the April 8 parliamentary elections.

But the opposition alliance which backed Fonseka presidential candidacy has crumbled, with other parties deciding to contest the legislative races on their own.