Updated

A disgruntled former aide who last year accused then-congressional candidate Carl DeMaio of sexual harassment has confessed to lying about a threatening email -- as part of a scheme to sabotage the Republican candidate's campaign.

Todd Bosnich, 29, pleaded guilty Friday to obstruction of justice for lying to investigators about the email. He had originally told investigators the email might have come from DeMaio; in fact, Bosnich sent the message to himself from a "bogus" Yahoo account.

Amid the allegations, DeMaio, an openly gay Republican, eventually lost his bid to unseat California Democratic Rep. Scott Peters by a narrow margin of 3.2 percent.

Assistant U.S. Attorney Phil Halpern said Bosnich’s actions “had the potential to affect a national election” and added that for reasons unknown, Bosnich had a “great deal of hostility and personal animus” toward DeMaio.

DeMaio, who is currently the co-host of an afternoon talk show on News Radio 600 KOGO in California, said Bosnich isn’t the only one to blame.

“Todd Bosnich smeared my reputation and he derailed our congressional campaign,” DeMaio said on his show Friday. “While the criminal prosecution today may hold Bosnich accountable on some level, Congressman Scott Peters shares ultimate responsibility for promoting Bosnich’s smears and lies for his own political gain.”

Calls made to Peters' Capitol Hill office by FoxNews.com were referred to his campaign office in California, which did not return calls.

DeMaio, a former San Diego councilman, had been a rising star in California politics. And as Election Day neared in 2014, DeMaio held a slight lead over Peters.

That changed when allegations surfaced in the final weeks of the campaign that DeMaio had made a series of unwanted sexual advances toward Bosnich in the spring of 2014. Bosnich said that when he complained to DeMaio’s campaign manager, he was offered $50,000 to keep quiet. He also said he received threatening emails and led people to believe they were from DeMaio, according to court documents.

DeMaio denied all of the allegations but the damage – at least politically -- had been done, in what would go down as one of the most expensive and nastiest races in state history.

Bosnich's attorney, Frank Vecchione, told The Associated Press that his client “is accepting responsibility and wants to move on with his life.”

Federal prosecutors declined to release the content of the threatening email but the plea agreement calls it "particularly ugly and threatening." It said Bosnich, who had left his position as campaign policy director at that time, would never work in politics again if he continued to make allegations against DeMaio.

Bosnich, who was allowed to remain free on $10,000 bond, faces a maximum penalty of 20 years in prison but prosecutors said they will recommend probation. He is scheduled to be sentenced on Aug. 31.

Bosnich admitted guilt in court but didn't address the substance of the allegations.

Dave McCulloch, DeMaio's campaign spokesman, said shortly after the November election that the controversy created "massive attrition and erosion" among the candidate's Republican base, including older, evangelical Christian voters, and created "an ick factor."

Eric Birnbaum, the FBI's special agent in charge in San Diego, said Bosnich "engaged in a pattern of lies and deceitful acts" to keep investigators off track.

"The integrity of the American electoral process is the very bedrock of our democracy," said Laura Duffy, U.S. attorney for the Southern District of California. "These actions were far from a harmless prank and cannot be tolerated."

The Associated Press contributed to this report.