Michael Cohen, the former longtime personal lawyer of President Donald Trump, was sentenced to three years in federal prison on Wednesday, taking a parting shot at the President after implicating him in hush money payments to two women over alleged affairs with Trump.

“It was my blind loyalty to this man that led me to take a path of darkness instead of light,” Cohen said in court, the Associated Press reported. “I felt it was my duty to cover up his dirty deeds.” Cohen said he had been “living in a personal and mental incarceration” since starting to work for Trump, the New York Times reported.

But U.S. District Judge William H. Pauley III said a tough sentence was warranted because “as a lawyer, Mr. Cohen should have known better.”

In August, Cohen pleaded guilty to tax evasion, campaign finance violations and making false financial statements — charges brought by prosecutors in New York’s Southern District. Cohen admitted that he worked at the direction of Trump to pay former Playboy model Karen McDougal and adult film star Stormy Daniels to keep quiet about their alleged affairs with Trump — which Cohen said was an effort to influence the 2016 election.

The U.S. Attorney’s Office for the Southern District of New York also announced a previously reached non-prosecution agreement with the parent company of the National Enquirer, American Media, Inc., which admitted to paying McDougal $150,000 “in concert with a candidate’s presidential campaign.” Before the 2016 election, the National Enquirer agreed to pay McDougal $150,000 for her story about the alleged affair, and then did not publish it. But AMI previously denied that the payment was intended to kill a story that could damage Trump.

On Wednesday, prosecutors announced AMI had admitted otherwise, saying “its principal purpose in making the payment was to suppress the woman’s story so as to prevent it from influencing the election.”

That admission could create more challenges for Trump, who has denied the affairs and denied that the payments were campaign contributions.

“What it tells me from this distance is they are really focused on the President and his potential liability for the campaign finance violations,” says Elie Honig, a former assistant U.S. Attorney in the Southern District. “If Donald Trump wasn’t the President of the United States, I would take one look at this and say, they’re circling the wagons around this guy. They’re going after this guy.”

Under existing Department of Justice policy, the President cannot be indicted.

“I think this is bad news for Trump and his associates because it shows that there is a witness. Cohen was not a cooperating witness, but AMI is cooperating,” says Harry Sandick, also a former federal prosector in the district. “The Southern District is not yet finished investigating this particular cluster of crimes.”

Cohen’s sentence aligns with the sentence of about three and a half years that prosecutors had recommended in a filing on Friday.

In a separate case, Cohen pleaded guilty last month to lying to Congress in 2017 about the timing and details of his work on a since-abandoned project to build a Trump tower in Russia. That charge was brought by Special Counsel Robert Mueller as part of his investigation into Russian interference in the 2016 presidential election.

Cohen received a two-month concurrent sentence in that case, which Mueller had recommended in his own filing on Friday, crediting Cohen for providing “credible and consistent” information in cooperation with the Russia investigation.

Get our Politics Newsletter. The headlines out of Washington never seem to slow. Subscribe to The D.C. Brief to make sense of what matters most. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Write to Katie Reilly at Katie.Reilly@time.com.