A former Massachusetts State Police lieutenant avoided jail after pleading guilty Wednesday to stealing more than $31,000 in overtime pay for shifts that he either never worked or failed to finish.

David Wilson, 59, of Charlton, a retired shift commander for the now disbanded Troop E responsible for traffic enforcement along the Massachusetts Turnpike, was sentenced in Suffolk Superior Court to two years of probation, was ordered to perform 200 hours of community service and repay the state almost $19,000.

A federal judge last year ordered him to pay more than $12,000 in restitution and gave him the same probationary sentence.

Wilson is among 46 troopers and retirees implicated in the overtime fraud scandal that included writing phony tickets and falsifying time sheets to collect overtime pay for hours never worked. Ten have been criminally charged.

Wilson's attorney declined comment after the hearing.

The state is trying to revoke his $105,000 annual pension. He has appealed.

The scandal has led to state police reforms, including GPS in cruisers.