Uganda must pay about $2bn (£1bn) in compensation to troops who served under ex-presidents Idi Amin and Milton Obote, judges have ruled.
The former soldiers are still part of the army, judges say
The country's appeals court said about 45,000 former soldiers had not been properly dismissed in 1979 and should receive back-pay.
The Ugandan army vowed to appeal against the ruling.
A spokesman said the ex-soldiers did not deserve to be paid and the military had no obligation towards them.
Correspondents say it is unclear how the Ugandan government could afford to pay the former troops even if it were prepared to do so.
However, the defence team expressed confidence that its clients would receive more than 20 years of back-pay.
One man who served under Idi Amin said he was thrilled with the victory and would use the money to give up work and relax.
Most of the former soldiers were disarmed and detained after President Yoweri Museveni seized power in Uganda in 1986. They were later released.