Federal authorities have arrested a United States soldier who discussed plans to attack a major American news network, shared detailed instructions online about how to build explosives and suggested that Beto O’Rourke, the Democratic presidential candidate, could be a potential target, the authorities said.

The soldier, Jarrett William Smith, a specialist assigned to the First Infantry Division in Fort Riley, Kan., had also once expressed a desire to travel to Ukraine to fight with a far-right paramilitary group, the authorities said.

Specialist Smith, 24, was arrested over the weekend and charged in federal court in Topeka, Kan., on Monday. He faces one count of distributing information related to explosives and weapons of mass destruction, according to the United States Attorney’s Office in Kansas.

If convicted, he could face up to 20 years in prison.

Before enlisting in the Army, Specialist Smith talked about his desire to fight in Ukraine with a far-right paramilitary group, according to an F.B.I. affidavit in the case that cited his social media exchange with another man who traveled there to fight.