Michael Cohen, the president’s former fixer who once famously claimed he was willing to "take a bullet" for Donald Trump before later turning against his boss, was sentenced to three years in prison Wednesday by a federal judge in New York after pleading guilty to numerous crimes while cooperating with prosecutors.

Before sentencing, Cohen ripped into his former boss in federal court, telling the judge he felt it was his duty to cover up the president's “dirty deeds.”

Cohen appeared before U.S. District Judge William Pauley III for sentencing after pleading guilty to campaign finance violations, tax evasion and lying to Congress about Trump’s past business dealings in Russia. He was seen entering the Manhattan courthouse Wednesday accompanied by members of his family.

Cohen doesn't have to report to prison until March 6. He also was ordered to pay $1.4 million in restitution and a $50,000 fine, and forfeit $500,000.

Speaking in court before the judge issued the sentence, Cohen said “blind loyalty” to Trump led him “to take a path of darkness instead of light.”

But Rudy Giuliani, an attorney for Trump, argued in a phone interview with Fox News that Cohen wasn’t always loyal – citing Cohen’s secret recordings of Trump that were later leaked to the press. The Cohen case, he said, shows the Mueller probe has turned into a “witch hunt.”

“Tell me what this has to do with Russia collusion?” Giuliani said of Cohen’s admission of guilt.

In court, a contrite Cohen told the judge he takes “full responsibility for each act,” saying the “sooner I am sentenced, the sooner I can return to my family."

Cohen also apologized to the people of the United States, saying, "You deserve to know the truth."

Michael Cohen, President Donald Trump's former personal attorney and fixer, arrives with his family at federal court for his sentencing hearing on December 12, 2018 in New York City. (Photo by Drew Angerer/Getty Images)

Michael Cohen, President Donald Trump's former personal attorney and fixer, arrives with his family at federal court for his sentencing hearing on December 12, 2018 in New York City. (Photo by Drew Angerer/Getty Images)

The sentence, while not the maximum, signifies a remarkable fall for the hard-charging lawyer who for years was part of Trump’s inner circle. The charges against Cohen arose from two separate investigations – one by federal prosecutors in New York, and the other by Special Counsel Robert Mueller.

Both cases hold potential implications for Trump. His admission in the former to breaking the law in making hush-money payments during the 2016 campaign to two women who claimed affairs with Trump has raised questions about whether prosecutors may eventually pursue charges against the president. Cohen said he did so at Trump's direction. Sentencing memos filed last week showed Cohen also told investigators about more Russia contacts that could fuel the collusion aspect of Mueller’s probe.

Lawyers for Cohen -- who worked as Trump’s counselor before the presidential campaign, advocated for him on television during the presidential race and remained his personal lawyer at the beginning of the administration -- had asked for leniency because of his cooperation with both the office of Special Counsel Mueller and prosecutors looking into campaign finance violations in New York.

But on Friday, federal prosecutors recommended a “substantial term of imprisonment” for Cohen, saying his efforts to cooperate with Mueller have been “overstated.” Federal prosecutors said that Cohen was “motivated” by “personal greed” and “repeatedly used his power and influence for deceptive ends.”

Among other charges, Cohen recently pleaded guilty to misleading Congress about his work on a proposal to build a Trump skyscraper in Moscow, hiding the fact that he continued to speak with Russians about the proposal well into the presidential campaign.

In the New York case, prosecutors accused Cohen of a years-long “tax evasion scheme” to avoid paying federal income taxes on more than $4 million made through a number of ventures, including through his ownership of taxi medallions, his selling of real estate in Florida and his consulting work for other clients.

Cohen also pleaded guilty in August to breaking campaign finance laws by helping orchestrate payments to silence former Playboy model Karen McDougal and adult film actress Stormy Daniels, who said they had sexual encounters with Trump while he was married.

READ: MICHAEL COHEN SENTENCING MEMO FILED BY PROSECUTORS

Prosecutors said Cohen orchestrated payments to McDougal and Daniels at Trump's direction.

A contrite Cohen, speaking in court, told the judge he takes “full responsibility for each act,” saying the “sooner I am sentenced, the sooner I can return to my family." (Photo by Eduardo Munoz Alvarez/Getty Images)

A contrite Cohen, speaking in court, told the judge he takes “full responsibility for each act,” saying the “sooner I am sentenced, the sooner I can return to my family." (Photo by Eduardo Munoz Alvarez/Getty Images)

The U.S. Attorneys Office also announced Wednesday they have agreed not to prosecute American Media, Inc., which publishes the National Enquirer, for its role in paying $150,000 for the rights to McDougal’s story. By purchasing and then refusing to run the story, the company was doing Trump a favor to keep the story out of the news before the 2016 election, prosecutors said. The U.S. Attorneys Office said AMI has cooperated with prosecutors.

Trump has lashed out at Cohen over his cooperation with prosecutors, recently saying Cohen “lied” and deserves to “serve a full and complete sentence.”

A sentencing memo filed by prosecutors said Cohen “acted in coordination and at the direction of” Trump in making those payments.” But in a tweet this week, Trump denied the payments to Daniels and McDougal were campaign contributions, instead calling them a “simple private transaction.” Trump also said if mistakes were made, the “liability” should be with Cohen, his lawyer, and not him.

“Cohen just trying to get his sentence reduced,” the president tweeted Monday.

Cohen is the latest example of people connected to Trump who have pleaded guilty or been convicted of crimes since Trump has entered the White House, including former national security adviser Michael Flynn, former campaign chairman Paul Manafort, former campaign aide Rick Gates and former campaign adviser George Papadopoulos.

Fox News' Catherine Herridge, John Roberts, Lissa Kaplan, Tara Prindiville and The Associated Press contributed to this report.