SAN FRANCISCO (CBS SF) — A political consultant pleaded guilty in federal court in San Francisco Wednesday to possessing a biological poison and an illegal gun and agreed to spend 12 years on supervised release with mental health treatment, drug testing and tough restrictions on computer use.

Ryan Chamberlain, 44, of San Francisco, pleaded guilty to the two counts before U.S. District Judge Vincent Chhabria.

READ MORE: San Jose Congregation Holds Fast Following Racist Easter Zoom-Bombing

Under the terms of a new plea agreement disclosed in court, Chamberlain was sentenced by Chhabria to two and one-half years in prison plus the 12 years of supervision by federal probation officials.

The two charges and the prison sentence are the same as in an earlier plea bargain in which Chamberlain pleaded guilty.

But the 12 years of supervised release is nine years longer than the three years originally proposed by prosecution and defense.

Last week, Chhabria rejected the original plea agreement after saying that three years of post-prison supervision wasn’t adequate to protect the public.

Chamberlain has been in custody since his arrest by the FBI in San Francisco on June 2, 2014. With credit for time served and good behavior in prison, he could be released as early as this summer.

Chamberlain told Chhabria before being sentenced, “This entire situation is a situation of depression, unfortunately created through suicidal ideation.

“Never was there a threat to the community. It was all internal problems,” he said.

The case began when FBI agents discovered that Chamberlain bought abrin, a poison made from the rosary pea plant, from a seller on an anonymous website called Black Market Revisited in December 2013. The powdered abrin was concealed in vials inside two flashlights.

Searches of Chamberlain’s Nob Hill apartment between May 31 and June 6, 2014, found the vials; a Derringer pistol with the serial number missing: materials that prosecutors claimed were the ingredients of a homemade bomb; castor beans, from which ricin, another toxin, is made; and sodium cyanide.

READ MORE: Hero Police Dog Saves Fresno Officer's Life Despite Being Stabbed 6 Times

Chamberlain posted an apparent suicide note on social media on June 2, 2014, and was arrested by the FBI near Crissy Field that evening.

The two counts to which Chamberlain pleaded guilty were possession of an unregistered biological toxin, namely abrin, and possession of a gun with the serial number removed.

Chamberlain was originally charged with four additional counts that were dropped as part of the plea agreement. Those now-dismissed charges were possessing a homemade bomb and possessing a total of three toxins – the abrin, ricin and sodium cyanide – for use as biological and chemical weapons.

Defense attorneys contended the alleged explosive ingredients would never have worked as bomb.

The supervised release conditions set by Chhabria prohibit Chamberlain from using computers or electronic devices without the permission of his probation officer; from using encrypted Internet services; and from accessing the Internet in any location, including at a future place of employment, without the officer’s permission.

Chamberlain must submit his computers, cell phones, other electronic devices, home and car to searches at any time. He must give his probation officer copies of his phone bills.

He is also required to undergo mental health treatment as directed by his probation officer and submit to periodic drug tests.

Prosecution and defense attorneys declined to comment after the sentencing.

In a sentencing brief, Assistant Federal Public Defender Elizabeth Falk said Chamberlain had suffered from depression and contended “the evidence shows that Mr. Chamberlain never, ever intended to hurt anyone with any item found in his apartment, other than himself.”

In a government brief, prosecutors wrote, “Although the defendant’s specific plans for these items are not clear, there is no doubt that their possession was secret and dangerous.”

MORE NEWS: Brother Joins Public Outcry Calling For Windsor Mayor Dominic Foppoli To Step Down

TM and © Copyright 2016 CBS Radio Inc. and its relevant subsidiaries. CBS RADIO and EYE Logo TM and Copyright 2016 CBS Broadcasting Inc. Used under license. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. Bay City News Service contributed to this report.