SEATTLE — A federal judge handed a nearly six-year prison term Friday to a Washington state man who amassed an arsenal of homemade "ghost guns" despite being on federal supervision for an earlier firearms conviction.

Nathan Brasfield, of Edmonds, was arrested in 2014 for being a felon in possession with a firearm. After serving a prison term, he began a period of supervised release in 2017.

Such supervision typically requires offenders to check in periodically with U.S. Probation and Pretrial Services and to grant probation officers access to their homes.

Nevertheless, Brasfield acquired several machines used in home manufacturing of firearms: a 3-D printer, drill press and computer numerical control machine — also known as a "ghost gunner" — and he started making guns.

Federal agents searched his home in February after customs agents found five silencers in a package addressed to him. Agents reported finding 17 pistols, 24 rifles and 10 silencers, with most of the guns being homemade and having no serial numbers. Such weapons are called "ghost guns" because of the difficulty of tracing them.

The complaint said agents also found 300 pounds (136 kg) of ammunition — thousands of rounds, "enough for a small war," Assistant U.S. Attorney Thomas Woods said in recommending a 70-month sentence.

In a letter to U.S. District Judge Richard Jones, Brasfield wrote that his long history of depression and other mental health issues had left him susceptible to the influence of doomsday talk on the internet. His attorneys noted that his long criminal history does not include violent crimes but rather felonies that include theft and possession of stolen property.

"My desire to collect guns, ammunition and chemicals was driven by a desire to be able to defend myself if society collapsed," Brasfield wrote. "I realize now that my overuse of social media, following alarmist figures made the threat of that collapse seem imminent."

Brasfield provided investigators with passwords to his electronic devices so they could verify he hadn't been selling the weapons he was making, and he informed them of one gun they didn't find, one that was hidden in an air duct. After his lawyers recommended a 54-month sentence, he had them revise it to 60 months, saying he deserved more time.

Jones agreed with the 70-month prison term recommended by prosecutors, noting that Brasfield's four-year sentence on the previous gun charge hadn't changed his behavior.