WASHINGTON — Edgar M. Welch, a 28-year-old father of two from Salisbury, N.C., recently read online that Comet Ping Pong, a pizza restaurant in northwest Washington, was harboring young children as sex slaves as part of a child-abuse ring led by Hillary Clinton.

The articles making those allegations were widespread across the web, appearing on sites including Facebook and Twitter. Apparently concerned, Mr. Welch drove about six hours on Sunday from his home to Comet Ping Pong to see the situation for himself, according to court documents. Not long after arriving at the pizzeria, the police said, he fired from an assault-like AR-15 rifle. The police arrested him. They found a rifle and a handgun in the restaurant. No one was hurt.

In an arraignment on Monday, a heavily tattooed Mr. Welch, wearing a white jumpsuit and shackles, was ordered held. According to the criminal complaint, he told the authorities that he was armed to help rescue children but that he surrendered peacefully after finding no evidence that “children were being harbored in the restaurant.” He was charged with four counts, including felony assault with a deadly weapon and carrying a gun without a license outside a home or business.

Unbeknown to Mr. Welch, what he had been reading online were fake news articles about Comet Ping Pong, which have swollen in number over time. The false articles against the pizzeria began appearing on social networks and websites in late October, not long before the presidential election, with the restaurant identified as being the headquarters for a child-trafficking ring.