A Medford man who threatened on social media to kill former President Barack Obama and FBI agents is going to federal prison for more than five years.

U.S. District Court Judge Michael J. McShane sentenced 62-year-old John Roos to 63 months after he pleaded guilty to the threats and to possessing an unregistered explosive device, according to a news release from the U.S. Department of Justice. Roos will serve three years of post-prison supervision upon his release.

"Violent social media posts are every bit as serious as those made in other venues," a statement from U.S. Attorney Billy J. Williams said. "We will continue to vigorously investigate and prosecute similar crimes."

Roos admitted in court to a Twitter post in which he threatened to kill Obama and the first family while using his account @indnjohnpatriot. That account has since been suspended, according to Twitter.

On Facebook, he threatened to "snipe" FBI agents with hunting rifles, the release said.

Roos said the threats against FBI agents were inspired by the fatal shooting of LaVoy Finicum during the occupation of the Malheur National Wildlife Refuge in January.

Federal agents arrested Roos April 28, 2016, outside the Southern Oregon Rehabilitation Center and Clinics in White City, where they found a loaded semi-automatic pistol in his vehicle. During a search of his Medford apartment, officers found several pipe bombs. He has been in jail since his April arrest.

Roos said the posts were a means to "blow off steam" and that he never intended to follow through with the threats, according to court documents.