Former state Sen. Leland Yee, who once aspired to statewide political office, will spend five years in federal prison for trading his political juice for money.

In a courtroom packed with family, observers and media, U.S. District Judge Charles Breyer on Wednesday imposed the sentence on the defrocked Bay Area politician, rejecting Yee’s bid for leniency and calling his sale of votes for money a “violation of the public trust.”

“The crimes that you committed have resulted in essentially an attack on democratic institutions,” Breyer told Yee, who nodded as the judge addressed him. “This is a serious, serious injury to a governmental institution.”

Dressed in a dark suit, a somber Yee had urged the judge to give him leniency, describing how he’s “ashamed” of his crimes and hoping to make amends to family and supporters. “I have taken full responsibility for my actions and crimes I have committed,” Yee said, his voice breaking. “That will haunt me the rest of my life.”

Yee and his lawyer declined comment after the sentencing. The judge gave him 30 days to surrender to the U.S. Marshal’s Service, which will turn him over to the federal prison system. James Lassart, Yee’s lawyer, asked the judge to recommend the sentence be served at the federal prison in Taft in Kern County.

The 67-year-old Yee pleaded guilty last year to racketeering charges in connection with allegations he accepted bribes in exchange for his political influence. The sentence punctuates a case that started with a sprawling undercover FBI probe of crime in San Francisco’s Chinatown and spread into the dark side of political dealing in Sacramento.

Acting U.S. Attorney Brian Stretch declined comment on the sentence. Federal prosecutors pushed for an eight-year sentence for Yee in his political corruption case, describing him in court papers as a public servant who “was willing to betray the trust of those who elected him” and “to sell his vote to the highest bidder.”

“Senator Yee abused that trust in the worst possible way,” Assistant U.S. Attorney Susan Badger told the judge Wednesday, urging punishment above federal sentencing guidelines. “It was to retain power as a public official.”

Despite Breyer’s harsh admonition of Yee, the sentence was ultimately closer to what the defense sought than the prosecution. Yee’s legal team asked the judge to sentence the former secretary of state hopeful to between four years and three months to a maximum of five years and three months, citing his career in public service. The defense insisted that Yee regrets his conduct, but did not act out of greed.

“He recognizes that his actions were wrong and he is remorseful and deeply regrets his conduct,” defense lawyers wrote to Breyer last week. “His widely publicized criminal activity has served as his own private punishment. He embarrassed himself, his family, and community by this shocking digression from his honorable career in public service.”

Yee unsuccessfully urged the judge to consider allowing him to serve his sentence in home detention instead of prison so that he can care for his ailing wife, arguing that sending him to prison would not serve any purpose.

Yee, a longtime San Francisco Democrat, was one of several state legislators charged with crimes in recent years in scandals that rocked the state Capitol. Legislators responded to the sentencing Wednesday with further calls for reform — state Sen. Patricia Bates, R-Laguna Niguel, introduced a bill directed at Yee’s conduct to close a loophole that allows the skirting of campaign contribution limits.

“Today’s sentencing of a former elected official underscores the need to close campaign finance loopholes wherever they exist,” Bates said.

Yee cut a plea deal with federal prosecutors, avoiding a trial but forcing him to admit he took payments in return for promises to use his political clout for a host of powerful interests, from NFL owners to medical marijuana businesses.

Yee was set to go on trial on political corruption, money laundering and gun trafficking charges last August along with three other defendants: political consultant Keith Jackson, his son, Brandon Jackson, and former sports agent Marlon Sullivan.

Those defendants also pleaded guilty to racketeering under separate plea deals with the U.S. attorney’s office. Breyer on Wednesday sentenced Keith Jackson, a former San Francisco school board president who put Yee in the FBI’s cross hairs, to nine years in prison, calling him a “one-person crime wave.” Prosecutors sought a 10-year term.

In the plea agreement, Yee admitted that he traded his political influence for bribes, typically offered by undercover FBI agents posing as potential campaign contributors. Yee, among other things, admitted he agreed to influence legislation for would-be medical marijuana businesses in California, an NFL team owner trying to exempt pro athletes from the state’s workers’ compensation laws and a fictitious FBI concocted software firm seeking government technology contracts.

The racketeering charge also contained allegations Yee tried to arrange an illegal international arms deal through the Philippines in exchange for money. Yee confirmed his role in that bizarre crime as well, but disputed that he had the ability to carry it out. Breyer called his involvement in that crime “hypocritical” and “unfathomable” given his past advocacy for gun control.

As for the political dealings, Yee admitted, for example, accepting an $11,000 cash bribe in June 2013 from an undercover FBI agent to help sponsor statewide marijuana legislation, according to his plea agreement. In addition, he admitted he laundered a $6,800 contribution to his secretary of state campaign in 2014, court records show. Overall, government officials identified more than $100,000 in bribes directed at Yee during the investigation, although his lawyers disputed that figure.

The FBI snagged Yee in the course of a five-year probe into reputed Chinatown crime boss Raymond “Shrimp Boy” Chow, who was convicted of racketeering charges in December after a lengthy trial. Chow is awaiting sentencing.

Howard Mintz covers legal affairs. Contact him at 408-286-0236 or follow him at Twitter.com/hmintz