HARRISBURG, Pa. (AP) — A former elected Pennsylvania state treasurer was sentenced Tuesday to 2½ years in federal prison for trying to squeeze campaign cash from a law firm and a property management firm during his failed 2014 bid for governor.

Rob McCord, a venture capitalist once seen as a rising star in Democratic political circles, cooperated with investigators and resigned in January 2015 after being confronted by the FBI with secretly-recorded audiotapes. He pleaded guilty to two counts of attempted extortion and testified last year against an investment adviser in a bribery case that ultimately got thrown out of court.

U.S. District Court Judge John Jones told McCord he "suffered a precipitous fall from grace" as a result of criminal acts the judge described as "an overt and even brazen effort by Mr. McCord to essentially shake down businesses and individuals to donate to his campaign."

"When an individual's ambition trumps his or her good judgment and their otherwise decent character, that's when crimes happen," Jones said.

He also imposed $5,200 in fines and fees and a year of probation. McCord is scheduled to report to prison in late October.

McCord, 59, divorced and now living with a brother in Chapel Hill, North Carolina, is studying to become a marriage and family counselor and works occasionally as a yoga instructor.

In court Tuesday, he admitted breaking the law and apologized to the public, his colleagues and others.

"I will spend the rest of my life trying to make amends," McCord said.

One count involved his contacts with the managing partner of a law firm that did contract work for the Treasury Department and other entities in state government. Jones' sentencing memorandum issued last month said McCord in spring 2014 "threatened economic harm" against the firm unless it boosted its campaign donations.

The victim in the other count was a property management firm that did state business. Jones wrote last month that McCord told a campaign donation "bundler" to warn the company about the potential "economic harm that could be inflicted" by McCord in his role as treasurer, to which he was elected in 2008.

McCord finished third in a four-person Democratic Party field in 2014, getting 17 percent of the vote. Tom Wolf won with 58 percent, beat incumbent GOP Gov. Tom Corbett in the fall and is currently seeking re-election.

Federal prosecutor Michael Consiglio told Jones he was concerned that McCord did not seem to accept the impact that his campaign contribution pressure played on his decisions as state treasurer.

"These were corrupt actions that affected official acts," Consiglio said.

Jones also presided at the trial last year of suburban Philadelphia investment adviser Richard Ireland, who had been charged with money laundering, fraud and conspiracy. McCord was considered a key witness against Ireland, taking the stand for four days, but weakness in his testimony was a main reason Jones threw out the case in the middle of trial.

Jones said at the time he dismissed the case that there was a lack of evidence that Ireland was providing money in return for official favors, and McCord did not provide it during his testimony.

Ireland had been accused of trying to bribe McCord with more than $500,000 in campaign contributions in what was called a yearslong scheme to land lucrative contracts to invest taxpayer dollars. Prosecutors claimed Ireland funneled the cash for six years to McCord's campaigns through friends, family members and employees of his business.

McCord's defense attorney, Robert E. Welsh Jr., told the judge that McCord has suffered the "complete ruination" of his career, a divorce and several years of being "basically on ice" while helping with other investigations.

Jones said he thought McCord approached fundraising like he had handled private business, as a deal making process. That seemed to become more pronounced "as the race began to get away from you," Jones said.