NEW YORK – A federal judge in Manhattan Wednesday sentenced Michael Cohen to 36 months in prison on charges of tax evasion, bank fraud, and campaign finance violations.

Cohen was given two months on the separate charge of lying to Congress brought by special counsel Robert Mueller. He was ordered to serve the two months concurrently with the 36-month sentence.

Before the sentence was handed down, Cohen gave an emotional statement to the court in which he said he had been living a life of “personal and mental incarceration by Donald Trump.”

U.S. District Judge William Pauley said Cohen should get some credit for providing assistance to the special counsel’s office but that the factor of deterrence warranted a significant prison sentence because of the corrosive effect his crimes had on American democracy.

Cohen mentioned to the judge President Trump’s tweets calling for the maximum term of incarceration and warned that “the President can weigh in on judicial matters that implicate him.”

“Today is the day I get my freedom back,” Cohen told the court, because he said he had been mentally incarcerated “ever since I accepted work from a famous business mogul.”

In deciding the sentence, the judge said Cohen had “lost his moral compass and sought to monetize his newfound influence.”

Cohen was not immediately taken into custody but was ordered to report to prison on March 6.

Cohen’s emotional appeal to the judge included an apology to his family, to the court, and to the people of the United States.

Cohen told the court that part of his reasoning for pleading guilty was “ensuring history will not remember me as the villain of this story.”

In addition to the prison time, the judge ordered Cohen to serve three years probation, forfeit $500,000 and to pay restitution of nearly $1.39 million for the tax evasion. He was also hit with fines of $50,000 in each of the two cases.

Cohen spoke to the judge after his own lawyer had pleaded his case and attorneys from the Manhattan U.S. Attorney’s Office and the special counsel’s office had made their arguments to the court. While the New York federal prosecutors continued to emphasize Cohen’s lack of cooperation, special counsel’s office attorney Jeannie S. Rhee said Cohen had “endeavored to account for his criminal conduct in numerous ways.”

Rhee added that she wanted to highlight to the court that the special counsel office’s “most appreciated that he has provided valuable information while taking care to note what he knows and what he does not know” rather than “inflate his value.”

The sentencing brought a conclusion to a very public saga that started when Cohen’s office and residence were raided by FBI agents in April.

After initially pledging to stick by Trump, the two men soon broke into opposing camps. Trump dismissed Cohen as just one of many attorneys who’ve done work for him, while Cohen announced over the summer that his first loyalty was to his own family and “country.”

On Aug. 21, Cohen pleaded guilty to tax evasion, bank fraud, and campaign finance violations. As part of a plea deal, Cohen admitted he helped coordinate hush money payments to two women who accused Trump of sleeping with them: Stormy Daniels and Karen McDougal.

In a dramatic courtroom moment, Cohen stood up and announced that he made the payouts “in coordination and at the direction of” Trump “for the purpose of influencing the 2016 election.”

Cohen spent the next few months sharing information with state and federal investigators. Trump and his allies threw darts at the “weak” former foot-soldier, insisting that Cohen’s financial crimes had nothing to do with the President. That dubious claim lost further credibility on Nov. 29, when Cohen admitted in a surprise courtroom appearance that he lied to Congress about his work to develop a Trump Tower building in Moscow during the campaign. That admission was part of a new deal with Mueller.

In a detailed sentencing memo the following day, Cohen’s lawyers asked for leniency, insisting that Cohen was simply following his former boss’ orders or taking actions to please him. Trump was fully briefed on everything from the hush money payments to the work on the Moscow project, they said.

In their own memos, both the SDNY and Mueller acknowledged that Cohen provided valuable information about the Trump campaign’s contacts with Russia as part of his cooperation. The SDNY prosecutors were harsher in their assessment, saying Cohen pointedly declined to provide information on other investigative matters they are pursuing.

With his sentencing complete, Cohen’s chapter of the story is more or less over, even as he continues to offer cooperation to investigators.

But key questions remain: whether the Trump Organization or its executives will face charges for the campaign finance violations; whether Cohen’s account contradicts Trump’s written answers to Mueller about his awareness of the Russia overtures; what other corporate wrongdoing investigators may have turned up over the course of their probe.

Over the course of just eight months, Cohen went from a trusted aide who would “take a bullet” for Trump to one of the greatest threats to Trump’s presidency.