WASHINGTON — State and federal authorities have detained a man in the Maryland suburbs of Washington who had declared himself “a joker” and had threatened to kill people after what appeared to be a workplace dispute, the police said on Friday. A hoard of weapons and ammunition was found at the man’s home, the authorities said.

Mark A. Magaw, the police chief in Prince George’s County, said that when the threats were reported, the echoes of the mass killing last week in Aurora, Colo., led the police to get an order from a judge allowing them to take the suspect into custody for psychiatric evaluation.

“He said, ‘I’m a joker, and I am going to load my guns and blow everybody up,’ ” Chief Magaw said, describing one of the threatening telephone conversations that the suspect, who was being fired, had with a co-worker this week. The threat was reported on Wednesday, and the suspect was taken into custody the next night.

An affidavit named the suspect as Neil E. Prescott. He was under observation at a hospital after he surrendered quietly, the police said.