Washington (CNN) Roger Stone, a longtime showman, political strategist and friend of President Donald Trump's, was sentenced Thursday to 40 months in prison.

Stone was convicted last fall of lying to Congress and threatening a witness regarding his efforts for Trump's 2016 campaign.

The sentencing is the culmination of an intense week that provoked Twitter fury from Trump and a reckoning within the Justice Department, leading a prosecutor to declare Thursday: "This prosecution is righteous." It's also the near-end of a case that's had several shocking moments that exposed Trump's interest in WikiLeaks during the campaign.

Judge Amy Berman Jackson spent much of the hearing criticizing Stone's actions and also defended the Justice Department prosecutors at the center of last week's drama.

"At his core, Mr. Stone is an insecure person who craves and recklessly pursues attention," she said, quoting a letter from trial witness Randy Credico, before issuing her sentence, which also includes 2 years of probation.

Without mentioning Trump's name, Jackson said claims Stone was being singled out for his politics were wrong.

Stone was not prosecuted "for standing up for the President," she said. "He was prosecuted for covering up for the President."

Prosecutors had initially asked Stone to be sentenced to seven to nine years in prison , resting that recommendation on the severity of his crimes and behavior. Trump called that ask "very unfair," however, in a late-night tweet. Attorney General William Barr overrode the recommendation the next day, saying seven years in prison would be too harsh a sentence.

Trump said Thursday his Stone "has a very good chance of exoneration."

"Roger has a very good chance of exoneration in my opinion," Trump said at an event in Las Vegas. Stone is asking for a new trial, and the President added he would let legal the process play out before making a decision on any clemency.

Although Jackson's sentence was ultimately much lower than the original request, the judge said prosecutors did the right thing when they followed the guidelines in their original efforts.

None of the prosecutors who won the case at trial signed the revised sentencing memo, and two new DC US Attorney's Office supervisors were assigned, exposing how politically charged the case has become inside the Justice Department.

New prosecutor John Crabb, Jr. said he wanted to apologize to the court for the confusion.

"This confusion was not caused by the original trial team," he said. "The original trial team had authorization to submit" the original sentencing memo.

Crabb said he stands by the original sentencing memo, adding, "it was done in good faith."

The Justice Department and US Attorney's Office operate "without fear, favor or political influence," Crabb added. "This prosecution is righteous."

"The court should impose a substantial period of incarceration," Crabb added.

Jackson also delivered a veiled swipe at the President during the hearing.

"For those of you who woke up last week" and decided sentencing guidelines are harsh, Jackson said, courts and defense lawyers have been acknowledging that for some time.

'It wasn't accidental'

Stone's actions "led to an inaccurate, incorrect and incomplete report" from the House on Russia, WikiLeaks and the Trump campaign, Jackson told the court. She also said she believed Stone's threats to Credico deserved a stronger sentence.

Stone also potentially threatened her on social media, the judge said.

"I suppose that I could say Roger Stone didn't intend to hurt me ... it's just classic bad judgment," Jackson said, then dismissing that idea. "It wasn't accidental."

"Incendiary activity is precisely what he's known for," she said. "The court should not sit idly buy, shrug its shoulders and say 'that's just Roger being Roger,'" Jackson said as Stone closed his eyes at counsel's table, fiddling with a pen and shifting his weight.

Jackson later added that Stone's actions -- not his politics -- led to his trial and conviction."

"This case did not arise because Roger Stone was being pursued by his political enemies," Jackson said. "It arose because Roger Stone characteristically injected himself smack into the middle of one of the most significant issues of the day."

As the judge read from the bench some of the obscenity-laced emails to Credico that supported his conviction for witness tampering, Stone turned briefly with a half smirk on his face and looked in the direction of his two rows of supporters in the room. Otherwise, Stone sat quietly and took notes as the judge spoke.

Stone left the courthouse without speaking to reporters.

Stone seeking new trial

Stone will not be detained immediately. He is still challenging his conviction by claiming juror misconduct , and Jackson is separately still considering his request for a new trial.

Stone's attorney, Seth Ginsburg, acknowledging that his client is known for his flamboyancy, asked the judge to go easy on him.

"Given Mr. Stone's larger-than-life persona, it's particularly important to remind the court that Stone" isn't just a public persona -- "he's a real human being," he said.

Jackson, an appointee of President Barack Obama, has developed a reputation for being a thorough judge, especially in handling cases from special counsel Robert Mueller's investigation. She is likely to revisit the highlights of Stone's time in court and may address the most recent prosecutor debacle. Previously, she sentenced former Trump campaign chairman Paul Manafort to prison for conspiracy and witness tampering crimes, and his deputy Gates to 45 days in prison for lying to investigators and conspiracy with Manafort.

Mueller investigation

In many ways, Stone's case had come to define Mueller's investigation.

During the campaign, Stone had sought to spread smears about Hillary Clinton and openly bragged of being in touch with WikiLeaks and its founder Julian Assange. Congress called him to testify, and he covered up discussions he had with Trump campaign officials about trying to reach Assange and efforts he made to use another associate of his as a WikiLeaks liaison.

Prosecutors said he lied about his efforts in order to protect the President.

When he was indicted in January 2019, CNN filmed a team of armed FBI agents swarming Stone's Florida home, arresting him before dawn.

It was the last set of criminal charges Mueller filed before he ended his investigation.

Awaiting trial, Stone amplified conspiracy theories about the Russia investigation on his social media accounts. In February 2019, he posted an image of Jackson with crosshairs behind her head, above a caption that called Mueller a "Deep State hitman."

Jackson then sharply restricted his social media use and ordered him not to speak publicly about his case, the Mueller investigation and the court.

He went to trial in November and was convicted on on seven counts -- telling Congress five lies, obstructing lawmakers from reviewing documents and threatening Credico to pressure him to lie to Congress so as not to expose Stone.

Credico and former top Trump campaign officials Rick Gates and Steve Bannon testified against Stone at trial, with Gates revealing he witnessed a conversation between Trump and Stone where the then-presidential candidate saying he expected more releases of information.

Democrats in the US House have since zeroed in on this testimony as contradictory to what Trump answered in written questions for the Mueller investigation.