Democratic former Assembly Speaker Sheldon Silver on Tuesday was sentenced to 12 years in prison for masking millions of dollars in bribes and kickbacks as legal fees and pay $5.1 million in forfeiture funds.

Federal prosecutors had sought more than 14 years for Silver, a record for an ex-elected official in New York. The current record holder, former Assemblyman Will Boyland, was convicted of bribery and is serving 14 years in prison.

He will also have to pay a $1.75 million fine.

He is scheduled to report on July 1.

“Today’s stiff sentence is a just and fitting end to Sheldon Silver’s long career of corruption,” said U.S. Attorney Preet Bharara.

But U.S. District Court Judge Valerie Caproni declined to follow sentencing guidelines in Silver’s case, declaring it would be “Draconian and unjust” considering his age and health. Silver, 72, revealed he was diagnosed with prostate cancer as he awaited sentencing.

Had Caproni followed those guidelines, Silver would have been sentenced to up to 27 years in prison.

As Silver awaited to be sentenced, U.S. Attorney Preet Bharara’s office successfully unsealed documents that alleged the former lawmaker had conducted extramarital affairs with two women, one a former member of the Assembly and a lobbyist, both of whom were accused of benefiting from their personal relationship with Silver.

Silver, the once powerful and unquestioned leader of the state Assembly since 1994, was found guilty in November of fraud and extortion, forcing him to surrender his seat in the Assembly in the process.

As Silver was being sentenced at a federal courthouse in lower Manhattan, his successor and winner of a special election last month, Alice Cancel, was sworn in to replace him in the Assembly. Cancel has ties to Silver’s political allies in the Assembly district and defeated Yuh-Line Niou, who ran on the Working Families Party line.

Silver’s downfall last year was followed by an unprecedented moment in state politics in which his counter part, Republican Senate Majority Leader Dean Skelos, was also later felled by a corruption scandal involving securing business for his son through official actions.

Skelos is due to be sentenced later this month.