On Dec.4, D.C. police detained a gunman who had walked into Comet Ping Pong, a popular Northwest Washington restaurant and music venue. Police said no injuries were reported. (Sharif Silmi)

A North Carolina man accused of commandeering a Washington pizza restaurant with an assault-style rifle in December is expected to plead guilty in a deal with federal prosecutors, both sides told a federal judge Wednesday.

Terms of the plea offer to Edgar Maddison Welch, 28, of Salisbury, N.C., were not disclosed. The U.S. attorney’s office for the District and Welch’s federal defender said they had agreed on a “plea in principle,” but declined to comment further at a previously scheduled court appearance after a deadline to accept the deal or face trial expired Monday.

U.S. District Judge Ketanji B. Jackson ordered the parties to submit final terms to her by Monday and set a March 24 plea agreement hearing.

Welch pleaded not guilty Dec. 16 to a federal charge of interstate transportation of a firearm and ammunition and to two D.C. offenses: assault with a dangerous weapon and possessing a firearm during the commission of a crime of violence.

Welch faced a statutory maximum of 10 years in prison if convicted of either the federal firearms or D.C. assault charges and a statutory maximum of 15 years in prison if convicted of the D.C. firearms count.

Meighan Stone leaves flowers and signs outside Comet Ping Pong on Dec. 5 in Washington. A man identified as Edgar Maddison Welch was arrested Sunday after coming to the restaurant armed. The incident was linked to fake news stories that have been dubbed “Pizzagate.” (Matt McClain/The Washington Post)

[Comet pizza gunman anticipated ‘violent confrontation,’ police say]

Under a deal, Welch could plead to fewer or lesser charges, and prosecutors could agree to a far shorter recommended sentence under federal guidelines that factor in variables such as a defendant’s criminal history, cooperation and the specific facts of the case.

Jackson is not obligated to accept a plea offer or agreed-upon sentencing recommendations.

[Welch’s parents say they are sorry for any heartaches son has caused]

In charging documents, an FBI agent said it appeared that Welch contemplated “a violent confrontation” at the restaurant, citing text messages, call records and other information retrieved from his phone.

Police said Welch was consumed with the viral conspiracy theory known as “Pizzagate,” which falsely linked Hillary Clinton to an alleged child sex trafficking ring. The story said the ring operated in the basement of Comet Ping Pong in upper Northwest D.C., where Clinton’s presidential campaign chairman, John Podesta, occasionally dined.

Welch prompted a panicked evacuation by customers on a Sunday afternoon, Dec. 4, police said, when he walked into the restaurant with a .38-caliber Colt revolver and a Colt AR-15 rifle strapped across his chest.

(Whitney Shefte/The Washington Post)

[Edgar Welch federal complaint]

Welch fired the assault-style weapon two or three times inside the restaurant, police said. They said he also pointed the rifle toward an employee who had emerged from a back area of the restaurant after everyone else fled.

Welch did not shoot anyone and surrendered after he found no evidence of hidden rooms or sex trafficking, police said.

Police said in charging documents that Welch anticipated that his efforts could end in violence and tried to recruit two ­co-conspirators, citing text and calling records.

“Raiding a pedo ring, possible [sic] sacrificing the lives of a few for the lives of many,” Welch texted a friend two days before he drove to Washington in a Toyota Prius, according to federal prosecutors. The text continued: “Standing up against a corrupt system that kidnaps, tortures and rapes ­babies and children in our own backyard.”

Friends and family members had said they thought Welch was on a mission to save children, not to hurt anybody.