BOSTON (Reuters) - A suburban Boston man arrested over the weekend illegally stockpiled weapons in violation of a court order and had mulled attacking a police station or a mosque, federal prosecutors said on Monday.

Forty-year-old Joseph Garguilo of Holliston, Massachusetts, appeared in court to face charges of being a prohibited person in possession of ammunition after the Federal Bureau of Investigation found an arsenal at his home. It included parts for an assault-style rifle, six ammunition magazines, Tasers and explosives.

Garguilo told a witness cooperating with law enforcement that he had considered bombing a police station or mosque, and that he feared the United States was on the brink of descending into disorder, according to court papers filed by federal prosecutors in Boston and seen by Reuters.

The search of his home also turned up handwritten notes threatening Muslims, prosecutors said.

In a brief court appearance, Garguilo denied wrongdoing. His defense attorney, Mark Meehan, told reporters the allegations grew out of a custody dispute.

"He's very distressed about all of this," Meehan said, according to an interview broadcast by Boston's WBZ radio. "He denies these allegations."

(Reporting by Scott Malone; Editing by Alan Crosby and Dan Grebler)