A federal judge has decided the first Virginia governor to be convicted of corruption is headed to prison. Bob McDonnell, once a star of the Republican Party, is now preparing to spend time in behind bars.

Tuesday in federal court in Richmond, Judge James Spencer sentenced former Virginia Governor Bob McDonnell to two years in prison followed by two years of supervised probation on 11 public corruption convictions.

In September 2014, McDonnell and his wife, Maureen, were convicted of promoting a dietary supplement in exchange for more than $165,000 in gifts and loans. Bob McDonnell testified in his own defense during a six-week jury trial that exposed details of the former first couple's strained marriage and shaky finances.

On Tuesday Bob McDonnell apologized for his mistakes, but he still says he did not violate his oath of office and will appeal. 

“I always try to put the best interests of the people first as governor but I have failed at times. For that I am deeply deeply sorry," McDonnell stated. "I have never ever betrayed my sacred oath of office in any way while I served as the governor of this great commonwealth."

Character witnesses testified Tuesday that the former governor was a good man, among them was former Virginia Governor Doug Wilder. He received applause from the courtroom when he challenged the prosecution's decision to give Jonnie Williams immunity. Williams is the businessman that the McDonnell was accused of providing political favors for in return gifts and loans.

Even though witnesses testified Bob McDonnell is a good man, the judge still felt prison time was appropriate. 

McDonnell's defense team had been advocating for community service. The leader of the charity, Operation Blessing, testified that the former governor's skills and connections would be wasted behind bars, when he could be helping grow their organization.

Prosecutors wanted a 10 year prison sentence, but the request was reduced to 6.5 to 8 years during arguments. This decrease in jail time came after the judge agreed with McDonnell's defense team that the value of the gifts and loans was too high, putting it at less than $121,000.  Judge Spencer also agreed with the defense that an obstruction of justice enhancement should not count toward those guidelines, because the former governor did not lie on the stand during trial.

Outside court, Dana Boente, the U.S. attorney for Virginia's Eastern District, said justice was served when the judge decided a two year prison sentence is appropriate. "Sometimes we see things differently, but we always maintain our respect for the system and the judge's sentence," she stated.

McDonnell thanked the judge for his leniency but said he plans on appealing. He must report to prison by February 9, but his defense team has vowed to appeal the conviction.

Maureen McDonnell has yet to learn her punishment She was convicted of nine counts at trial but just last month, the judge overturned an obstruction of justice charge, citing lack of evidence. Her sentencing is scheduled for February 20 at the federal courthouse in Richmond.

The Associated Press contributed to this article.