COURTESY/PROVIDED PHOTOS Eric Krieg, pictured left and right, admitted to mailing a pipe bomb that injured a pregnant postal worker last year.

WASHINGTON ― A right-wing blogger and former political candidate who mailed a pipe bomb that injured a pregnant postal worker last year has reached a plea deal with federal prosecutors that would send him to prison for 29 years.

Eric Krieg, a 46-year-old Indiana man, was arrested last year after a pipe bomb intended for an attorney who had filed a defamation lawsuit against Krieg exploded at a post office in East Chicago, Indiana. Krieg had also mailed a package that included a bullet and a threatening message to another victim who had mocked Krieg in online forums.

Under the plea agreement, which still must be accepted by a federal judge, Krieg would plead guilty to four counts: making an unregistered destructive device; mailing a destructive device; malicious use of explosive materials; and mailing a threatening communication. The malicious use of explosive materials charge carries a mandatory minimum sentence of seven years.

Krieg acknowledged in his plea agreement that, from 2012 until 2017, he “engaged in a series of online postings and communications” about other residences of northwest Indiana, and that he filed for bankruptcy after an individual filed a lawsuit against him based on statements he made on his blog.

Krieg, who went by the handle “buzzcut,” wrote a blog titled “Blue County in a Red State” that purported to discuss life “in the most corrupt county in America: Lake County, Indiana.” He wrote in his plea deal that he had to pay the attorney’s client $45,000 and apologize online for defamatory statements he’d made on his blog.

“In retaliation for the filing and settling of this lawsuit and other grudges I held, I devised a plan to construct and mail a pipe bomb that I hoped and believed would kill or injure Victim 1,” Krieg wrote in his plea agreement. “I constructed his pipe bomb and knew that it contained explosives and items that would produce shrapnel.”

Krieg, a former BP engineer who in 2011 ran in the Republican primary for Lake County Council and in 2012 ran for Lake County surveyor, had been set to go to trial earlier this month, but his lawyer had requested a continuance until June.

The plea deal agreement comes a month after Trump supporter Cesar Sayoc was arrested for mailing over a dozen suspicious packages to critics of the president.

Ryan Reilly is HuffPost’s senior justice reporter covering the Justice Department, federal law enforcement, criminal justice and legal affairs. Have a tip? Reach him at ryan.reilly@huffpost.com or on Signal at 202-527-9261.