Attorney Michael Cohen was sentenced to three years in prison on Wednesday after helping federal investigators who have been looking into his former client, President Donald Trump.

U.S. District Judge William H. Pauley III said in his ruling that Cohen deserved a harsh punishment for his crimes.

Before the sentencing in federal court, Cohen ripped into his former boss, telling the judge he felt it was his duty to cover up the president’s “dirty deeds,” as Fox News and other outlets noted.

His lawyer tried to argue Cohen should be spared jail time because he cooperated in multiple federal investigations involving Trump.

The judge rejected the request in his ruling, the Associated Press reported.

Cohen became a person of interest early on to a special counsel investigation into the president, given Cohen’s close connection to the president and business contacts in Russia.

Robert Mueller has been leading the special counsel investigation into whether or not the president or his associates colluded with Russian interests to sway the presidential election of 2016.

Related: Special Counsel Recommends ‘Substantial’ but Fair Sentence for Cohen

The special counsel team suggested that Cohen receive a tough but fair sentence in a court filing on December 7. The filing argued that the punishment should reflect his lies — but also his efforts to remediate his misconduct.

Cohen has worked with federal investigators since turning himself in August 21.

Who do you think would win the Presidency?

By completing the poll, you agree to receive emails from LifeZette, occasional offers from our partners and that you've read and agree to our privacy policy and legal statement.

Cohen pleaded guilty to eight criminal charges that afternoon. He guilty plea included tax evasion worth $1.4 million, lying to lawmakers, and arranging payments in an alleged violation of campaign finance law.

He paid off porn actress Stormy Daniels for allegedly having an affair with the president — something Trump has vehemently denied.

Cohen drew particular attention for his involvement in a project to build a Trump hotel in Moscow. He had previously claimed the talks about the Moscow project had ended prior to the 2016 election season’s ramp-up. He admitted in federal court last week to lying about how much he discussed the proposed Moscow project with the president.

Related: Trump’s Former Lawyer Admits He Lied to Congress About Moscow Project

Cohen accepted additional charges as part of the plea deal he reached with the special counsel.

He admitted in federal court last month to lying about how much he discussed the proposed Moscow project with the president.

Trump responded to the plea deal by calling his former lawyer “weak” and that Cohen was just looking for reduced time.

Check out this video: