The Justice Department announced Friday it had charged a Russian woman who prosecutors say conspired to interfere with the 2018 U.S. election, marking the first criminal case that accuses a foreign national of interfering in the upcoming midterms.

Elena Khusyaynova, 44, was charged with conspiracy to defraud the United States. Prosecutors said she managed the finances of “Project Lakhta,” a foreign influence operation they said was designed “to sow discord in the U.S. political system” by pushing arguments and misinformation online about a host of divisive political issues, including immigration, the Confederate flag, gun control and National Football League protests during the national anthem.

The charges against Khusyaynova came just as the Office of the Director of National Intelligence warned that it was concerned about “ongoing campaigns” by Russia, China and Iran to interfere with the upcoming midterm elections and the 2020 race — an ominous message just weeks before voters head to the polls.

Prosecutors said the sophisticated campaign Khusyaynova was a part of “did not exclusively adopt one ideological viewpoint” but instead tried to push incendiary positions on various political controversies on social media platforms. The Russians involved, prosecutors said, created fake personas and spread their divisive messages on Facebook, Twitter and Instagram. The group attempted to sow conflict along racial lines and sometimes advocated positions that directly opposed each other, apparently agnostic to whom they supported as long as it turned Americans against one another, prosecutors said.

For example, in relaying how to discuss an August 2017 story about special counsel Robert S. Mueller III, one operation participant said Mueller should be termed “a puppet of the establishment” whose work was “damaging to the country,” according to prosecutors. But later that year, another operation member tweeted: “If Trump fires Robert Mueller, we have to take to the streets in protest. Our democracy is at stake.”

The group took similarly cynical positions on U.S. politicians. While one account said President Trump “deserves a Nobel Peace Prize” for agreeing to meet with North Korean leader Kim Jong Un, another predicted Trump “might not even be president by then.” One tweet encouraged voters to donate to a political action committee aiming to unseat Senate Democrats Tammy Baldwin (Wis.), Claire McCaskill (Mo.) and Elizabeth Warren (Mass.), as well as House Minority Leader Nancy Pelosi (D-Calif.)

As a reporter tried to ask about the charges Friday, Trump interjected: “Had nothing to do with my campaign. You know, all of the hackers and all of the — everybody that you see, nothing to do with my campaign. If the hackers — a lot of them probably like Hillary Clinton better than me. Now they do. Now they do.”

He added, “We’ve done a lot to protect the elections coming up.”

Those involved in the conspiracy, prosecutors said, would analyze U.S. news articles and advise how to draft messages about those stories. For example, before his death in August, operation participants advised that Sen. John McCain (R-Ariz.) should be branded “an old geezer who has lost it,” and they said House Speaker Paul D. Ryan (R-Wis.) should be portrayed as “a complete and absolute nobody.”

“The strategic goal of this alleged conspiracy, which continues to this day, is to sow discord in the U.S. political system and to undermine faith in our democratic institutions,” said G. Zachary Terwilliger, the U.S. attorney for the Eastern District of Virginia.

Facebook, which owns Instagram, said in a statement: “Combatting election interference is a task that requires cooperation from government and private industry.”

Twitter declined to comment.

The messages spread widely on the platforms; prosecutors say one Facebook page reached over 1.3 million people, while several of the Twitter accounts had tens of thousands of followers.

The operation did not seem to include any outright hacking efforts. In a statement, the Office of the Director of National Intelligence said officials “do not have any evidence of a compromise or disruption of infrastructure that would enable adversaries to prevent voting, change vote counts or disrupt our ability to tally votes in the midterm elections.” But the statement noted: “We are concerned about ongoing campaigns by Russia, China and other foreign actors, including Iran, to undermine confidence in democratic institutions and influence public sentiment and government policies. These activities also may seek to influence voter perceptions and decision making in the 2018 and 2020 U.S. elections.”

The statement, which was joined by the Justice Department, FBI and Department of Homeland Security, came on the eve of a trip national security adviser John Bolton is making to Moscow, where he is expected to raise the issue with his counterparts.

A Russian Foreign Ministry spokeswoman did not respond to a request for comment.

Court papers say Khusyaynova’s operation was funded by Russian oligarch Yevgeniy Prigozhin, an associate of Russian President Vladi­mir Putin who is known as “Putin’s chef,” and two companies he controls: Concord Management and Consulting, and Concord Catering. A federal judge in Washington this week expressed reservations about the special-counsel office’s prosecution of one of Prigozhin’s companies and directed Mueller’s prosecutors to provide a more detailed response to the company’s bid to dismiss the central charge.

A criminal complaint filed against Khusyaynova charges that she managed the finances of Project Lakhta, including detailed expenses for activities in the United States.

Between 2016 and 2018, Project Lakhta’s proposed operating budget exceeded $35 million, although only a portion of that money targeted the United States, prosecutors said.

Lakhta is the name of a neighborhood in St. Petersburg near the location of the longtime office of the Internet Research Agency, a Russian troll farm that has been the focus of special-counsel prosecutors. The agency moved to an office building, called Lakhta-2, in the neighborhood last winter, according to Russian news reports.

Investigating Russian interference in U.S. elections has largely been the purview of Mueller, though his probe is focused on the 2016 election and the Trump campaign. His office has charged a dozen Russian military officers with hacking Democrats’ computers, as well as 13 people and three companies that his prosecutors allege ran an online propaganda operation to push voters away from Hillary Clinton and toward Trump in 2016.

The members of Project Lakhta seemed keenly aware of Mueller’s work. After the special counsel’s indictment of the 13 Russian nationals in February, alleging similar behavior in the 2016 election, one alleged member of the operation tweeted that he hoped the accused were sent to Guantanamo Bay prison. But, he added, apparently hoping to convince U.S. voters of his position: “We didn’t vote for Trump because of a couple hashtags shilled by the Russians. We voted for Trump because he convinced us to vote for Trump.”

The group communicated with real Americans to advance their work. For example, in July 2017, one of the conspirators used a fake “Helen Christopherson” Facebook account to contact three real U.S. organizations to collaborate with the groups in opposing Trump. One of those organizations agreed to make the “Helen Christopherson” account a co-organizer of an anti-Trump event on Facebook.

The case is being prosecuted by lawyers in the cyber division of the U.S. attorney’s office in the Eastern District of Virginia and the Justice Department national security division’s counterintelligence and export-control section.

The complaint against Khusyaynova was filed under seal in late September and kept secret for three weeks. Officials said the calculation to publicly unveil the accusations now was based on a number of factors, including the unlikelihood that the suspect, who is believed to be in Russia, might travel to a country where she could be arrested and the pending meeting between Bolton and Russian officials, allowing him to raise the issue with them now that the complaint has been made public.

Overriding all of those concerns, officials said, was a desire to raise public awareness about Russian political influence campaigns — to warn voters that such activity was not limited to the 2016 campaign and that fake online personas are still trying to manipulate Americans heading to the polls in a matter of days.

The Justice Department has been broadly assessing how it should respond to foreign influence operations targeting U.S. elections, and this summer it issued a lengthy report on the topic. U.S. officials have warned repeatedly about foreign attempts to influence the 2018 midterms.

Anton Troianovski in Moscow and Craig Timberg, Spencer S. Hsu and Rosalind S. Helderman in Washington contributed to this report.