Russian election meddlers had strict guidelines for how to foment anger in America, right down to scripts for how to mock political leaders or key media figures in ways that would resonate with angry partisans.

Operatives were told in their online posts to label the late Sen. John McCain “as an old geezer who has lost it,” or fellow Republican House Speaker Paul D. Ryan as an “absolute nobody incapable of any decisiveness.”

Gay-rights supporters, meanwhile, should be enticed by infographics, but the Russian operatives said they liked their online screeds dumbed down. The Russians recommended using “short text in large font and a colorful picture.”

Those details emerged late last week as the Justice Department announced charges against Elena Alekseevna Khusyaynova, a 44-year-old Russian the government says was the chief accountant for the Moscow-backed internet troll program “Project Lakhta.”

That’s the same operation U.S. authorities say meddled in the 2016 presidential election and, according to the latest charges, continues to feed the angry discourse in the U.S. in an attempt to sow discord. Lawmakers said the new charges make clear the Russian government hasn’t surrendered its determination to interfere with American politics.

With two weeks to go before the midterm elections, U.S. officials said they’re doing everything they can to try to combat meddling — although the administration is sending mixed signals on whether Russia or China poses the bigger threat.

FBI and Department of Homeland Security officials say they’re monitoring possible electronic hacking of state election systems with special “intrusion detection” sensors that can identify attempts to attack voter databases and voting machines.

Homeland Security conducted a “tabletop” exercise for the media in suburban Washington to show how the federal government is protecting election systems nationwide. Russia was the main culprit most often cited.

Undersecretary Christopher C. Krebs told reporters that the government hasn’t detected attacks on voting machines or voter databases in 2018, but he said foreign efforts to influence American voters on social media are ongoing.

“We continue to see Russians, and increasingly Iranian and other Chinese actors, continue to use social media to influence the American public, to sow discord and increase divisiveness,” he said. “That’s something that is probably just a tool of the trade for them right now.”

Intelligence officials have been warning that Russia remains the main culprit of election meddling, but other Trump administration officials in recent weeks have taken aim at China as a chief instigator.

Vice President Mike Pence accused Beijing this month of waging a “comprehensive and coordinated campaign” to undermine political support for Mr. Trump in the U.S.

“To put it bluntly, President Trump’s leadership is working. China wants a different American president,” Mr. Pence said.

As far as the potential for more foreign interference, federal and state officials are treating this year’s midterm election as a warm-up exercise for guarding against meddling in the presidential election two years hence.

Mr. Krebs said so far this year, “We’re not seeing anything anywhere remotely close to” the level of meddling that occurred in 2016.

The federal government has provided states with grants totaling $380 million to enhance security of election systems, including the deployment of so-called “Albert monitors,” devices that can detect cyber intrusions into networks. There are now such monitors covering about 90 percent of the nation’s election systems, compared with 30 percent coverage in 2016, he said.

“If the Russians or some other nation-state has a form of communication, we can give the indicators to the states to highlight the communication with the bad infrastructure,” Mr. Krebs said. “They can flag it for us … and we can do a deeper dive.”

American officials said in court papers unsealed Friday that the ongoing Russian disruption campaign is aimed at both liberal and conservative audiences, and they had specific rules about how to reach both sides.

“If you write posts in a liberal group … you must not use Breitbart titles,” one piece of guidance said, referring to the right-wing internet publication. “On the contrary, if you write posts in a conservative group, do not use Washington Post of BuzzFeed’s titles.”

In one specific example included in the complaint the Russian operation plotted how to message around a 2017 Breitbart piece titled “Paul Ryan opposes Trump’s immigration cuts.”

“Brand Ryan as a complete and absolute nobody incapable of any decisiveness,” the Russian guidance said, referring to the U.S. speaker of the House, a Republican and usual ally of President Trump. “State that the only way to get rid of Ryan from Congress, provided he wins in the 2018 primaries, is to vote in favor of Randy Brice, an American veteran and an iron worker and a Democrat.”

While that piece explicitly backed a Democrat, most of the examples of press reports included in the complaint seemed to back Mr. Trump’s message, particularly on immigration.

Of the 11 pieces the government highlighted that saw action by Russian trolls, three were from Breitbart, two were from Fox News, two more from Infowars, and one apiece from a local TV station, World Net Daily, and websites TruePundit and LibertyHeadlines.

From the left, the trolls created a Twitter account under @wokeluisa, which focused heavily on claims of discrimination against African Americans and the national anthem debate. That account had 55,000 followers as of earlier this year, the government says.