Former Hudson River Café owner Hamlet Peralta was sentenced to 5 years in prison Friday for running a Ponzi scheme that involved Jona Rechnitz, the real estate investor who has become a key government witness in multiple probes of political corruption in New York City.

Manhattan U.S. District Judge Katherine Forrest said she didn’t know why Peralta, 38, decided to shift focus from his successful restaurant to luring investors into a scheme to wholesale liquor, but it drew him into a “vortex” of deceit that raised $12 million and left $5 million in losses.

“The moral compass you had was not pointing north,” she said. “It was askew.”

The sentence followed a hearing focused in large part on Rechnitz, who was wiretapped in the Peralta case, became a key informant in a probe of Mayor Bill de Blasio, and is expected to be a star witness in upcoming corruption trials of former corrections union boss Norman Seabrook and of two former NYPD officials.

Defense lawyer Cesar deCastro told Forrest that Rechnitz charged an 18 percent commission over six weeks for recruiting investors, eventually put in $3 million of his own money to cover investors he had recruited, and then used veiled threats that made Peralta fear for his life if he didn’t pay up.

Rechnitz even pressed for Peralta to get a life insurance policy to cover his debts if he died, deCastro said, and became a driving force who made Peralta dig a deeper hole because Rechnitz wanted money to fuel his local corruption schemes.

“He needed cash to do everything else he was doing, which is all the related cases — peddling influence in local government and having the NYPD on speed dial,” deCastro said.

But prosecutor Kan Nawaday told Forrest that Rechnitz was irrelevant to Peralta’s sentencing, and that despite threats, high-interest rates and his role as a recruiter for the scheme he was like any other victim.

“He was duped by Mr. Peralta into believing this was a real investment vehicle,” Nawaday said. Prosecutors included money for Rechnitz in their request for $5 million in restitution.

Forrest concluded that Rechnitz, at least for Peralta’s case, was a side issue, because Ponzi schemers have to anticipate demands from investors. “People who have put money into a scheme want to get paid and they create pressure,” she said.

Rechnitz has pleaded guilty to conspiracy for his involvement in local corruption cases.

He allegedly sought influence in City Hall in return for donations to the mayor, was a bagman who delivered payoffs to Seabrook for investing union pension money into a hedge fund, and was part of scheme to pay off former NYPD Dep. Chief Michael Harrington and Dep. Insp. James Grant in return for perks.

But he has not been charged for recruiting investors into Peralta’s deals or for his alleged role finding investors in a different $70 million Ponzi scam involving ticket resales in which Jason Nissen of Roslyn was charged this year.