Few people in Washington now doubt that Russia tried to interfere with the 2016 presidential election. As more information about the response to that interference has been publicly disclosed, it’s become clear that key decisions were made by good people trying to do the right thing for the right reasons that nevertheless led to bad outcomes. The accounts of former FBI Director James Comey and of other government officials indicate that, in the run up to the election, their choices were influenced by the fear of appearing political—even as their actions inadvertently may have created exactly that impression.

Make no mistake—Russia will attack again. Yet right now, America hasn’t made any progress towards building a nonpartisan system that could respond to Russia—or any other foreign adversary. The United States has made no policy changes to ensure that if the exact same situation presented itself in next year’s congressional midterms or in the 2020 presidential election, its leaders wouldn’t face the same hard choices that Obama’s White House faced last summer.

Neither Obama nor any future president can respond to interference in our election without provoking accusations of partisanship. America needs a system that credibly protects its electoral system and responds to foreign actors in real-time. In my service as the assistant attorney general for national security until last October, I saw first-hand the determination of foreign adversaries to exploit American vulnerabilities. After the 2016 campaign, foreign actors realize that effective attacks can disrupt American democracy. Unless the United States takes the response out of the realm of partisan politics, by setting up something akin to a “dead man’s switch” that triggers automatically when something goes awry, they’ll attack again—and succeed.

The United States intelligence community—all 17 agencies—has concluded that Russia interfered with the 2016 presidential election. As Comey put it during his congressional testimony, there is “no fuzz … whatsoever” on the question of Russia’s activities. Even President Trump referred in a recent tweet to Russian “meddling” in the election.

But Russia’s advanced, sophisticated, and multi-pronged attack on American democracy last year isn’t exactly breaking news.

In fact, it was clear during the presidential campaign. By late September, the two top Democrats on the congressional intelligence committees outlined their belief that Russia was behind the attacks on Hillary Clinton’s campaign; in October, Director of National Intelligence James Clapper and Homeland Security Secretary Jeh Johnson in a joint statement announced “that the intelligence community is confident the Russian Government directed the recent compromises of e-mails from U.S. persons and institutions, including from U.S. political organizations.”

Despite these concerns, the Obama administration waited until after the election to retaliate against Russia, including imposing tough sanctions and expelling Russian diplomats.

Deciding how to respond to Russia during the campaign was a difficult decision, former Obama officials have said repeatedly in recent weeks. As they explained, any harsh response could have been seen as Obama unfairly influencing the campaign, using the power of his office to help his favored candidate. Some Republicans would have cried abuse of power; throughout this period, after all, their candidate for president was claiming repeatedly that the election was “rigged,” refusing even to say that he’d accept the outcome of the November election if he lost.

Any response in the run-up to the election would have carried potential risks. But in the end, the absence of a forceful and immediate bipartisan U.S. response gave Russia far too much space and time to continue its campaign of interference. The pre-election warnings, in hindsight, were too little too late. Only afterwards did Russia face any punishment, and it was not sufficient to convince Russia that the costs outweigh the benefits.

So what could the United States have done differently? There is no wall high enough or moat wide enough to keep out a dedicated adversary—that’s particularly true in cyberspace. The U.S. must create guidance and policies that ensure that decision-makers are able to navigate the same tricky political waters when the next attack comes.

This begins with mapping out a nonpartisan process in advance, one that relies on the career government-intelligence professionals and analysts whose professional lives have been spent drawing conclusions about foreign motives—and then uses the tools the U.S. already has at its disposal to respond.

A body like the National Intelligence Council, the group of career analysts who help issue consensus national intelligence assessments, could be designated in advance to monitor whether a foreign actor is seeking to interfere with an election—whether through disinformation campaigns, hacking candidates or political parties, or through actual attacks on the election infrastructure. If the NIC finds with a high degree of confidence that a foreign power—Russia or any other country—is trying to influence the election or undermine confidence in it, it should make that finding public as fast as possible. Even if it can’t say in detail what precise impact a foreign adversary is having, in order to protect intelligence sources and methods, the American people deserve better real-time information regarding the sanctity and security of the democratic process.

This analysis and conclusion should be conducted entirely removed from political appointees, just as the Justice Department traditionally defers to career professionals and prosecutors in making sensitive decisions around political corruption cases to avoid even the appearance of a conflict of interest. The response cannot be allowed to be sidetracked by partisan politics, as it appears it was last fall when Republican leaders in Congress refused to sign on to statements condemning Russia’s efforts. Taking his inspiration from Article 5 of the NATO treaty, which sees an attack on one country as an attack on the whole alliance, Senator Lindsey Graham has called for bipartisan agreement in advance that “an attack on one party is an attack on all.”

Retaliation for such attacks should also be prescribed in advance—a menu of options, agreed upon by the intelligence community, the White House, and congressional leadership, that would pull from the many tools used over the past decade to deter and influence foreign countries’ bad behavior in cyberspace. The United States has shown in recent years the many weapons in its arsenal for responding to cyber attacks from foreign nations—including public condemnations, international sanctions, the expulsion of foreign diplomats, and even the filing of criminal charges. These responses have already helped shape the behavior of adversaries like North Korea, China, and Iran—and the U.S. should make more use of them in the future, as well as employing additional covert methods.

The United States took many of these actions after the election, leveling sanctions, expelling Russian diplomats, and closing Russian compounds inside the United States. But it is clear in retrospect that the response should have come sooner and with bipartisan backing. In the future, particularly if procedures are worked out in advance, the United States could lead decisive multilateral action with other western democracies at the first sign of interference—as allies like France, the United Kingdom, and Germany all share an interest in promoting democratic institutions and keeping foreign actors out of their own elections.

The message must be clear to foreign adversaries long before America approach its next election: Any attempt to attack campaigns, candidates, or voting systems will be met with prompt and strong retaliatory action. Attacks on elections are attacks on America—and should be protected against at all costs.