The state's highest court says former Massachusetts House Speaker Salvatore DiMasi is entitled to the money he contributed into the state's retirement system, plus interest, before his conviction on corruption charges.

But the Supreme Judicial Court on Thursday rejected arguments from DiMasi's attorneys that he should have continued to receive his state pension from the time he was sentenced in 2011 until all his appeals were exhausted in 2014.

The justices said the state retirement board was wrong to withhold from the Boston Democrat the $127,000 he paid into the pension system during his time as a lawmaker. The money must now be repaid with interest.

A federal jury convicted DiMasi of using his clout as speaker to steer two state contracts to a software firm in exchange for payments.