Former Assembly Speaker Sheldon Silver was sentenced to 12 years in a federal penitentiary Tuesday by a Manhattan judge who called him “a scheming corrupt politician.”

The Manhattan Democrat — one of the most powerful politicians in the state before his arrest last year — also was ordered to fork over nearly $5.2 in ill-gotten gains and another $1.75 million in fines.

The disgraced ex-pol was handed two prison terms by federal Judge Valerie Caproni: 12 years for the six criminal counts against him, including mail and wire fraud and extortion, and another 10 years on a seventh count involving money-laundering. The terms will run concurrently.

Silver must surrender to begin serving his sentence July 1.

The conviction and hefty sentence — the second highest for a state politician convicted of corruption in the past decade — has capped a stellar run of Albany and New York City corruption cases brought by Manhattan US Attorney Preet Bharara and federal authorities in Brooklyn.

Bharara stood in the back of the courtroom to watch Silver’s justice meted out.

“Today’s stiff sentence is a just and fitting end to Sheldon Silver’s long career of corruption,’’ Bharara later said in a statement.

Today's stiff sentence is a just and fitting end to Sheldon Silver's long career of corruption — US Attorney Bharara (@PreetBharara) May 3, 2016

In court, a humbled Silver told Judge Caproni, “I believe that my letter to the court probably captured it best — without question, I let down my family, let down my colleagues, let down my constituents, and I’m truly, truly sorry for that.”

The 72-year-old kept his head lowered as his sentence was rendered and then briefly closed his eyes.

Silver’s long-suffering wife, Rosa, remained stoic, even as Caproni lit into her husband for his politically-charged extramarital affairs which Bharara’s prosecutors detailed in filings — one with a lobbyist who had extensive business before the state and another with a former beauty-queen turned assemblywoman who landed two cushy public-service jobs.

“Did a lobbyist have preferred access because she was a better lobbyist than her competitors, or was it payback for a personal relationship?’’ Caproni said before sentencing the shamed ex-pol.

“Did Silver do things just to be nice — or did he do things because somewhere there was something in it for him?” she added.

One of Silver’s lawyer’s asked the judge to recommend that he be sent to the Otisville minimum-security “camp’’ in upstate Orange County. Caproni said she would do so, although the final decision is up to the federal Bureau of Prisons.

Before sentencing, Caproni appeared somewhat sympathetic to Silver, saying, “I have to agree with the defense that the letters [in support of Silver] clearly … paint a picture of a gifted politician who went above and beyond call of duty many times for friends, friends of friends and for constituents.

“Some do it better than others. It is clear that you did it quite well,’’ she told Silver, who she called “a scheming corrupt politician.”

“I hope that the sentence I’m going to impose on you will make the next politician hesitate just long enough before taking a bribe or a kickback, for his better angels to take over,’’ Caproni said.

“Or if there are no better angels, and for some people, there are not, then maybe his fear of living out his golden years in an orange jumpsuit will put him on the straight and narrow.”

The judge added that the sentence should “send a message that this is not how business is done in Albany,” adding that “no one, including Sheldon Silver, is above the law.”

A Manhattan federal jury found Silver guilty in November of abusing his power for more than a decade in exchange for bribes and kickbacks.

Silver faced as much as 27 years in prison for his crimes, but federal prosecutors told the judge they simply wanted Silver to serve out a longer sentence than any other New York legislator.

Ex-Assemblyman William Boyland Jr. has held that title since 2015, when he was sentenced to 14 years.

When it came to Silver, there were “no excuses, just pure greed — and then he tried to hide his crime proceeds by investing them,’’ Assistant US Attorney Carrie Cohen told Caproni before sentencing.

The feds slammed Silver’s earlier apology letter to the court.

“Instead of accusing the government of trying to harm him and his reputation by quote ‘choosing to focus its spotlight on him,’ he could’ve admitted he himself is to blame for the investigation and the conviction and the prosecution that revealed the truth and resulted in his downfall,’’ said Assistant US Attorney Howard Master.

“After all, he is the one who put himself there.”

But Caproni warned before sentencing that she wasn’t going for the max, calling it “, “Let me tell you now, I’m not going to impose a guideline sentence in this case. I think imposing a guideline sentence would be draconian … given this defendant’s age.”

Silver’s lawyers had requested community service and home confinement, citing his history of good works and his recently diagnosed prostate cancer. Silver’s brother, Joseph, died of prostate cancer at age 70 and their dad died of it at 80 years old.

In pleading for leniency, Silver’s lawyers submitted dozens of letters from constituents, childhood friends and long-time neighbors.

Silver’s son and three daughters told the judge about their modest upbringing, and his wife, a former schoolteacher, talked about her fear that he will be sick and alone in jail.

One of his lawyers, Steven Cohen, in arguing for a light sentence, told Caproni, “If there’s going to be an incarceration, what is really needed to serve the purpose here? What is the benefit that is truly rendered to society?”

Silver lawyer Joel Cohen pleaded, “He won’t weather this storm. Whatever leniency we have from you, your honor, he has already been crushed. He has been devastated by everything.

“His obituary has already been written about … notwithstanding everything he has done.”

After three days of deliberation, the Manhattan federal jury found that Silver accepted $3 million in payments from the law firm Weitz & Luxenberg, despite doing no legal work.

Instead, Silver was paid based off his cozy relationship with a Columbia University doctor, who received $500, 000 in state funds to finance his research into mesothelioma, a cancer caused by asbestos. In exchange, the doctor referred asbestos patients to Weitz & Luxenberg, which then paid Silver.

The jury also found that the Lower East Side resident earned $700,000 from a separate law firm after hooking them up with a pair of lucrative real-estate-developer clients. While receiving money from the developers, Silver took state actions that benefited them.

The government has already blocked Silver from access to $3.8 million in assets spread across eight different bank and investment accounts.

The ex-Assemblyman also has another $2 million, including “readily liquid assets of more than $1 million,” the government said in a recent filing.

The judge said Silver’s $70,000 a year pension is currently worth $850,000.

Minutes before his sentencing, the judge issued a ruling denying Silver’s motion for a new trial.

“Silver does not offer any new arguments for the Court to consider … and instead rehashes old arguments that were appropriately rejected’’ at trial, Judge Caproni wrote.“There was sufficient evidence to sustain each of the convictions.’’

Silver and his lawyers vowed to appeal.

“I believe in the justice system in this nation, and we will pursue whatever remedies the system makes available” Silver said before zipping off in a yellow cab.

His lawyer, Steven Molo, added, “We are obviously disappointed in the court’s decision. We are going to be filing an appeal with the United States Court of appeals, and that is where the case will go next.’’

Additional reporting by Kevin Fasick and Carl Campanile