Foreign influence was never supposed to be part of America’s elections. What is a democracy if not rule by a country’s own citizens?

Sitting in offices in St. Petersburg, Russia, however, employees of the Internet Research Agency (IRA) had plenty of ideas about how to waltz past American legal and political safeguards to sow discord and try to manipulate the US midterm elections this fall.

Internal messages by the group’s officers to its staff advised that LGBT groups and “their liberal allies” were active online late into the night and responded well to manipulative infographics and colorful pictures, unlike their conservative counterparts.

John McCain — a critic of Russia and an advocate for higher military spending — was to be branded “an old geezer” in online messaging, even on his deathbed. Paul Ryan — who notably said last July that “Russia is not our ally” — was to be branded on social media as a “two-faced loudmouth.”

These were just a few of efforts by the Russian organization’s online army of trolls to promote divisive messages on hot political topics ranging from sanctuary cities to illegal voting to whether athletes stood or knelt during the national anthem at NFL games.

The result was to short-change democratic discourse in the US — an outcome made possible by the shortcomings of the US laws and rules that are supposed to ensure fair election outcomes.

Operation Lakhta

The snarky guidance provided to the Russian trolls, according to a detailed US federal court filing last week, was part of Operation Lakhta, which itself was just one aspect of Russia’s attack on American democracy.

It was laid bare when prosecutors in the Eastern District of Virginia revealed on October 19 they had taken the Washington mantra “follow the money” to heart in tracking the activities of Russian citizen Elena Khusyaynova, chief accountant of Operation Lakhta.

According to the filing, she “managed the financing of substantially all aspects of the Project [Lakhta] operations” and — luckily for prosecutors but perhaps unluckily for Russia — Khusyaynova kept “meticulous” records, covering her payments for rent, travel, furniture, and even garbage disposal. It’s unclear how the emails arrived in Washington, but creative Western hacking seems a distinct possibility.

The indictment says Operation Lakhta had an ever-increasing budget that reached more than $1 million per month earlier this year. Much of that money was used to purchase and promote posts on social media, develop and promote online videos, buy ads on Facebook and Instagram, and pay “activists” and “bloggers.”

The operation also included promoting political rallies and counter-protests, all in an effort to “inflame passions” and conduct what the Russian-financed internet trolls themselves called “information warfare against the United States of America.”

Those involved were instructed not to use news sites like Breitbart in their social media posts when trying to influence liberal groups, and to avoid outlets like the Washington Post and BuzzFeed when trying to win over conservatives.

They were also given “Tasking Specifics” with content that reflected deep knowledge of American political jargon, including such terms as “RINO” (Republicans In Name Only) and “anchor babies” (used pejoratively to refer to children born in the United States to non-citizens).

And they demonstrated a sense of humor by using a seemingly pro-Trump Twitter account labeled “@CovfefeNationUS” to post or retweet more than 23,000 messages, including one encouraging people to donate money to a political action committee opposed to Democrats.

Prosecutors found a law to use against Khusyaynova, charging her with conspiracy to defraud the United States by acting as an undisclosed foreign agent, in violation of requirements that such agents register and publicly declare their ambitions. They also said she broke Federal Election Commission laws prohibiting foreign expenditures in American elections.

How foreign money can taint elections

But are these laws enough?

They haven’t proven much of a deterrent so far — some of the activities depicted in the indictment took place this year, long after Russian involvement in the 2016 election had been well exposed. Moreover, there are other, more direct ways that foreign money can corrupt the system, without breaking any existing laws.

Two Supreme Court decisions — the 2007 Wisconsin Right to Life ruling that Congress could not ban “issue ads” in advance of elections and the 2010 Citizens United ruling that said corporations have a First Amendment right to engage in political spending — opened the floodgates for “dark money,” that is, money whose source is unknown.

Since the 2007 case, more than $900 million from hidden donors has spilled into federal elections, according to an April report from the Brennan Center for Justice.

The main route has been to give the funds to politically oriented nonprofit organizations, which are allowed to raise unlimited amounts of cash from individuals, other organizations, and corporations without disclosing who those donors are, and then to spend it on issue-oriented advertising meant to influence election outcomes.

Foreigners can also exert influence through US companies they own or control, including US-registered Limited Liability Corporations (LLCs), which can act as shell companies to disguise the source of their funds and the names of the owners or controllers.

While the law prohibits companies based outside the United States from spending on US elections, foreign-owned companies based in the United States can do so as long as the money comes from their US revenues and a US citizen — not a foreigner — decides where that money goes. But there is no real way to check who is responsible.

This is particularly worrisome if a supposedly private company acts as a “proxy” for a government, a common set-up in places like Russia, whose president has bragged about “patriotic hackers” and other ostensibly private citizens who just so happen to act in the interest of the Russian government.

Although Moscow has tried to distance itself from some of the groups that intruded into the political debate, there’s little doubt that their work was all part of a well-organized campaign.

Just as foreign influence operations can be “laundered” through private companies and nonprofits, so can direct political donations. Special counsel Robert Mueller is reportedly looking at political disbursements from the National Rifle Association (NRA) to determine if Russia funneled money through the organization to influence the election.

In the 2016 presidential election, the NRA spent more than $30 million to support Donald Trump’s campaign. That is more than it had spent in all races — House, Senate, and White House — during the 2008 and 2012 elections combined. Where did that money come from?

We don’t know. But take the case of Maria Butina, the alleged Russian foreign agent who is accused of trying to influence a number of Republican officials, particularly through the NRA.

She and her boyfriend, Paul Erickson, a top Republican operative with connections to the NRA who tried to broker a meeting between Trump and Vladimir Putin in May 2016, created an LLC, ostensibly to pay Butina’s education bills.

Erickson, on his own, set up several other LLCs. He has not been charged with any wrongdoing — but paying university tuition through an LLC is more than a bit odd. We don’t know if the LLC had a wider role, for example, in funneling Russian money to the NRA or other political organizations.

Numerous media reports have said Mueller is also looking at a total of $285,000 in payments to Trump’s inauguration fund, reelection campaign fund, and the Republican National Committee from a man named Andrew Intrater.

Intrater is the American cousin of Viktor Vekselberg, a Russian oligarch whose company is under US sanctions. Intrater wasn’t a big political donor before 2016. (Even larger donations to Trump’s inauguration were made by others considered close to Vekselberg and Russia.)

We don’t know much about the circumstances of all these donations, but it’s clear that a flow of funds between foreign-connected Americans and major US politicians reasonably raises questions about who is buying what and why.

Weak US campaign finance laws helped create this situation

The Brennan Center has some ideas about how to ameliorate the risks of foreign election influence: It recommends more transparency — with more disclosure of the source of funding for radio and television ads before elections, and complete disclosure of funding sources for dark money groups.

It says companies owned or controlled by foreigners but based in America should be completely barred from making political contributions. And it calls for more vigorous enforcement of the rules by the Federal Election Commission, which has long been hobbled by partisan bickering.

Here’s the rub: These steps would almost certainly help. But foreign governments will always seek a way to influence us, and water will always find a crack to enter. Until we truly clamp down on the overall flow of money in politics, we are leaving open a wide avenue for infiltration.

While Russia must be held accountable for its actions, we need to remember that their tactics took advantage of a freewheeling culture of paid political influence that we created ourselves.

Alex Finley (@alexzfinley) is the pen name of a former journalist and an officer of the CIA from 2003 to 2009, who is now writing analyses of Robert Mueller’s investigation for the Center for Public Integrity. She is the author of Victor in the Rubble, a satire about the CIA and the war on terror. The Center for Public Integrity is a nonprofit, nonpartisan investigative journalism organization in Washington, DC.