ATHENS, Greece — A Greek court has ruled that an anarchist who went on hunger strike after being held in pre-trial detention for nearly three years should be released on bail, a day after a doctor warned he was at the "final stage" of life.

Kostas Sakkas, 29, was arrested in 2010 on terrorism charges and jailed pending trial. But as the deadline for the 18-month legal limit allowed for pre-trial detention approached, authorities brought additional charges and refused to release him. He has been on hunger strike since June 4.

The case has triggered a heated dispute between the conservative-led coalition government and left-wing opposition.

A three-member panel of appeals judges ruled Thursday that Sakkas should be released on a 30,000-euro bond. He is banned from leaving the greater Athens area.