The election of a Democratic House of Representatives begins the process of holding President Trump accountable and brings into focus how, in the years to come, Americans should think about repairing the damage he inflicted. To us, Trump’s abuse of our law enforcement and intelligence agencies—where we recently worked—has echoes of the era that culminated in President Nixon’s resignation. But the events of the years after Nixon resigned hold important lessons for the current moment, as well.

While this presidency is far from over, the incoming Congress offers an opportunity to compare that past with this present, to examine what Congress did after Nixon departed, and to prescribe steps that the next president and future Congresses must take to insulate the nation from similar misconduct.

First, the history. Three months after Nixon resigned, the 1974 midterm elections swept in huge majorities for Democrats in the House and the Senate—majorities that Democrats maintained in both chambers for the next six years. Working with both a Republican president (Gerald Ford) and a Democratic president (Jimmy Carter), the Democratic Congress fixed much of what Nixon broke.

The Privacy Act (which protects Americans’ personal information in the government’s possession), the Foreign Intelligence Surveillance Act (a landmark bill establishing standards for the surveillance of U.S citizens), and the Inspector General Act (which established independent oversight mechanisms across executive branch departments and agencies), among others, took wing during those six years. So did myriad other statutes and reforms. Some worked, some didn’t, but all were in response to a president who disdained the rule of law and were designed to reassure a weary public that rules and norms matter.

Some five decades later, the country again has a president who disdains norms, to put it mildly. And though Trump’s corruption has a slightly different flavor, it is of a kind and on a par with Nixon’s. But if Congress’s goal post-Nixon was to protect civil liberties from law enforcement and intelligence agencies, the goal this time around should be protecting those agencies from the presidency and from politics.

While reserving some of his harshest criticism for law enforcement and intelligence professionals—calling them “disgraceful,” “scum” and “corrupt,” among other choice epithets—Trump has also attempted to leverage their work for his personal ends. Consider his collusion with (soon to be former) House intelligence committee Chairman Devin Nunes, which led to the executive branch’s declassification of the “Nunes memo.” That memo, written solely for political purposes and citing cherry-picked information derived from sensitive sources and methods, was designed to mislead and slander the U.S. national security community and its work by calling into question the integrity and impartiality of those who, in the eyes of Trump, investigated Russia’s subversion of American democracy.

The president also directed his Justice Department and director of national intelligence to share thousands of pages of classified and investigative materials—the likes of which rarely leave the FBI and Justice Department—with Congress. Presumably he did so in the hopes that this sensitive information would leak, including in partisan media outlets. Judging by headlines in recent months, his bet paid off.

Congress has an important oversight function, but these recent efforts have not been about legitimate oversight. Instead, they represent an effort to sow doubt in the minds of Americans about the integrity of law enforcement and intelligence professionals, generally, and the emerging case against the president, specifically. At the same time, the oversight committees’ assault on the very departments and agencies they are charged with overseeing degrades their ability to perform their core function: The lack of trust and even outright hostility between the committees and the intelligence and law enforcement communities will render those communities less willing to provide information pursuant to legitimate requests.

We have every reason to expect this behavior will cease when a new Congress is sworn in this January. But looking forward after the end of this presidency, preventing future abuses will be easier said than done. Unlike the post-Nixon reforms, the solutions do not center on reigning in the national security apparatus. Despite what Trump routinely claims, there’s no evidence of systematic wrongdoing on the part of intelligence and law enforcement institutions. Instead, this reform effort will need to reign in the presidency and Congress—providing insulation against another chief executive willing to abuse intelligence and law enforcement for personal political benefit.

What would that look like?

For starters, the next president could enshrine in an executive order the previously unremarkable notion that law enforcement and intelligence professionals have an obligation to protect sensitive sources and methods, even in the context of congressional inquiries. A simple articulation of longstanding and ordinary practice could offer future national security principals cover to push back on politically-driven congressional requests.

Regarding declassification authority, the next president could also delegate these decisions to the relevant Cabinet official, like the attorney general or director of national intelligence. (Director of National Intelligence Dan Coats apparently had deep concerns with Trump’s efforts to release the Nunes memo.) This is essentially what the Obama administration did when declassifying intelligence on Russia’s election interference. It was the director of national intelligence who put his name to these efforts—in part to underscore that these decisions transcended politics.

Finally, Congress, too, must take steps to ensure hyper-partisans are no longer able to wield the legislature’s most powerful tools to aid a political ally to the detriment of national security. A profound step in the right direction for the post-Trump era would entail the Intelligence and Judiciary Committees of both chambers committing to exercise subpoena power in the national security arena only with bipartisan consensus. Doing so would confine their efforts to legitimate oversight, not political point-scoring.

We are under no illusion that the executive and legislative branches will eagerly constrain themselves. People in power seldom do. At the same time, we are confident the grave damage done by the Trump administration requires it.