BOSTON (AP) -- A man has been charged with posting on an FBI website that he planned to kill President Barack Obama.

President Barack Obama (AP Photo/Jacquelyn Martin)

Twenty-eight-year-old Andrew O'Keefe, of Mansfield, was charged with a felony count of posting an online threat against the president. He made an initial appearance Monday in U.S. District Court in Boston and was ordered held in custody.

According to court documents, when law enforcement officers tried to interview O'Keefe regarding the May 13 posting, he refused to speak with officers outside his home. Authorities say more than 100 weapons were found at his home and in his vehicle, including swords, double-edged knives, hatchets and spears.

He faces a maximum sentence of five years in prison if convicted.

A preliminary hearing was scheduled for July 29.

O'Keefe's attorney, William Cintolo, didn't immediately return a call seeking comment.

O'Keefe is also accused of threatening North Attleboro police with a 4-foot sword in November and faces state charges for that.

A prosecutor in the state case said O'Keefe had been diagnosed with bipolar disorder, The Sun Chronicle newspaper reported.

(© 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed)