Federal officials are recommending early release from prison for former Massachusetts House Speaker Salvatore DiMasi as he battles cancer.

The U.S. Bureau of Prisons and federal prosecutors filed a court notice requesting that DiMasi's sentence be reduced to time already served so he can be released immediately. The once-powerful Democrat has served almost five years of an eight-year prison term for corruption.

Since his 2011 conviction, DiMasi was diagnosed with tongue cancer and later prostate cancer.

Thursday's compassionate release recommendation for DiMasi is intended for inmates with terminal illnesses as well as elderly inmates who have served a significant portion of their sentences. A judge must approve the request.

The 71-year-old DiMasi, a Democrat, was convicted of steering state contracts to a software firm in exchange for $65,000 in payments.