RICHMOND, Virginia — A U.S. federal judge sentenced former Virginia Gov. Robert McDonnell to two years in prison and two years of probation Tuesday for a corruption conviction.

McDonnell, the first Virginia governor to be convicted of taking a bribe, was sentenced by U.S. District Judge James Spencer for accepting sweetheart loans and lavish gifts from a businessman seeking to promote a dietary supplement.

“No one wants to see the governor of Virginia in this kind of trouble,” Spencer said before imposing sentence. “It breaks my heart, but a meaningful sentence must be imposed.”

McDonnell, once a rising star in the Republican Party, was convicted in September with his estranged wife, Maureen, in a trial that laid bare rifts in their marriage.

McDonnell, 60, was ordered to report to prison on Feb. 9. Defense attorneys asked he be sent to a prison in Petersburg, Virginia, so he could be close to his family.

Prosecutors sought a 10- to 12-year prison term. McDonnell’s lawyers argued for community service sentence instead.

A jury found McDonnell guilty of 11 charges of public corruption in September. He and his wife were charged with receiving $177,000 in loans and gifts from dietary supplement entrepreneur Jonnie Williams Sr. in exchange for promoting his company’s main product, the anti-inflammatory Anatabloc.

Sixty percent of Virginia adults believed McDonnell should go to prison, according to a poll in October by the University of Mary Washington’s Center for Leadership and Media Studies.

Trial prosecutors contended McDonnell and his wife conspired to use the governor’s office to boost Williams’ company, Star Scientific Inc., and Anatabloc.

Gifts to the couple included a $6,500 Rolex watch, wedding and engagement presents, money for McDonnell’s daughters, as well as golf outings and equipment.

Williams provided a $50,000 loan and a $15,000 “gift” to cover wedding expenses. He also gave a $70,000 loan to a corporation the governor and his sister used to manage beach properties.

Maureen McDonnell, 60, was convicted of nine counts, but Spencer dismissed the obstruction of justice charge last month.

The former first lady is scheduled to be sentenced Feb. 20. Attorneys for the couple have said they will appeal the convictions.