A federal judge on Friday sentenced a civilian Navy intelligence official — at the center of a mysterious, and apparently criminal, scheme to make hundreds of rifle silencers for a supposedly secret military project — to six months in prison and a California hot-rod mechanic who helped him to 60 days.

U.S. District Judge Leonie M. Brinkema said she took “no pleasure” in sending Lee M. Hall, a civilian Navy intelligence official, to prison, but she believed she must to deter others who might act as he did. Earlier she sentenced Mark S. Landersman, the mechanic, a spokesman for the U.S. Attorney’s Office said.

Both men were convicted in late 2014 of conspiring to build 349 untraceable silencers and shipping them across state lines for a sensitive mission that was never fully explained in court. Prosecutors asserted the arrangement was a $1.6 million sweetheart deal to enrich Landersman, whose brother, David Landersman, was Hall’s boss in the Navy and has also been charged in the case.

Defense attorneys for both men argued that their clients believed the project was legitimate. In court Friday, Hall apologized to the Navy and the U.S. government for “having to deal with this very difficult issue,” but he maintained that he never thought he was doing wrong.

“At the time I took my actions, I truly believed there was a need for these materials,” he said.

Brinkema said in court that she would put Hall’s sentence on hold if he appealed his case.