I am no fan of recently fired FBI Director James Comey. As part of a team documenting human rights abuses in the US, I’ve seen too many examples in recent years of overreach and lack of transparency by the agency, and aggressive pursuit of greater FBI powers by Comey himself, to feel otherwise. Yet in the aftermath of his firing by a president who has shown a clear aversion to the normal checks and balances of democratic governance, the risks of an abusive and politically compromised FBI are suddenly much greater.

Every society needs effective, intelligent law enforcement to conduct criminal investigations, help bring offenders to account, and prevent abuses of power. At its best, the FBI does just that: It investigates complex cases involving violence or corruption and provides evidence for prosecutions that respect due process and the rule of law.

But it works only because it’s independent of those in power. Without that independence, it couldn’t be trusted to fairly and thoroughly hold the powerful to account, or to conduct unbiased investigations of others. Without independence, it also risks becoming a tool of those in power, to persecute opponents or disfavored groups.

Trump’s firing of Comey risks that independence. As someone who is familiar with the ways the FBI can abuse its power, I’m keenly aware of the need for checks on that power. The last thing that the FBI needs is someone in charge who answers to the president.

The FBI has made huge mistakes in the past. Comey shares part of that blame.

The FBI has a history of being used for political ends. Under its first director, J. Edgar Hoover, the FBI was a deeply politicized agency. Between 1956 and 1971 it regularly engaged in illegal operations, known collectively as Cointelpro, aimed at carrying out surveillance on, smearing, and discrediting anti-war groups and civil rights activists. The agency’s targets included the Rev. Martin Luther King Jr., whom the agency had under extensive surveillance, casting him as a “threat.” The FBI even sent him letters urging him to commit suicide.

As Betty Medsger described in her book The Burglary, Cointelpro was only brought to an end after a group of private citizens broke into the FBI offices in Media, Pennsylvania, in 1971, and seized FBI files that began to expose the agency’s dirty tricks. A few years later, a Senate committee led by Sen. Frank Church also investigated the FBI’s abuses and pressed for a number of reforms — including establishing the intelligence oversight committees in the House and Senate — meant to prevent such abuses from happening again.

Since then, the FBI has never experienced a scandal of that magnitude. However, the agency has at times been implicated in abusive behavior — including under Comey’s leadership. My own organization has documented how, in the past 10 years, the agency has been involved in targeting American Muslims in abusive counterterrorism “sting operations” based on religious and ethnic identity.

In some of these cases, the FBI, working through informants, seems to have selected vulnerable individuals — children, people with mental disabilities, or poor people — and then developed a terrorist plot, persuading and sometimes pressuring the targets to participate, and providing the resources to carry it out.

By suggesting the idea of taking terrorist actions and encouraging the target to act, the agency may have created terrorists out of law-abiding people. The cases we documented in our report predated Comey’s arrival at the FBI, though he was at the Department of Justice at the time. But to our knowledge, he did not take steps to rein in these abuses once at the agency’s helm in 2013. Instead, recent reports suggest these patterns continue and may have become even more troubling.

Comey came into the FBI with a strong reputation for standing up to power in the name of respecting the Constitution: In 2004, when he was serving as acting attorney general, White House officials tried to get him to sign off on a massive warrantless surveillance program. Comey objected to a component of the program. When then-President George W. Bush then reauthorized the program anyway, Comey threatened to resign. Bush ended up backing off and the program was temporarily suspended.

Despite Comey’s principled stance on warrantless surveillance at that time, the FBI has in recent years increased its ability to access information obtained without a warrant, thanks to the vast expansion of mass intelligence surveillance by the National Security Agency and other agencies. The FBI is empowered to conduct warrantless “back door searches” of massive amounts of the data and contents of communications, including from Americans, that the National Security Agency has gathered without a warrant.

In turn, the Bureau can distribute this data to federal, state, or local law enforcement. That means there’s a risk that information obtained by the NSA might be used against defendants without their knowledge in cases that have nothing to do with counter-terrorism operations, undermining core constitutional protections for the rights to privacy and a fair trial.

Comey also made a big push to force technology companies to build a “back door” into widely used encrypted phones and chat applications. The Obama administration never threw its full weight behind the effort and it stalled in the face of opposition. But if he had gone forward with his plans to weaken encryption, they would have endangered human rights activists worldwide, as well as ordinary people and businesses who rely on encryption to protect their data from malicious actors.

There is a lot to criticize about Comey and the FBI under his leadership. But there’s even more to worry about with his firing.

My organization has spent years fighting discrimination and misconduct by law enforcement, as well as the expansion of mass surveillance. We have collected stories of how the FBI surveilled American-Muslim communities based on their ethnic and religious makeup, and in some cases entrapped people who might otherwise have had no ties to terror-related activities. Still, Trump’s firing of Comey magnifies these concerns many times over.

The furor over Comey’s firing erupted because of its apparent relation to the FBI’s ongoing investigation of whether members of Trump’s presidential campaign colluded with Russia to prevent Hillary Clinton's election. Many people view the firing as a deliberate attempt to derail those inquiries.

But Comey’s dismissal also raises serious concerns about Trump’s willingness to respect the FBI’s independence and integrity. Trump’s own admission that he called Comey to inquire whether he was under investigation, and his reference to having had multiple conversations on the topic, reveals an effort to exert political influence over the agency.

It also comes during a presidency whose rhetoric has been contemptuous of institutions and processes that are at the heart of US democracy. Trump has continually railed against the media, labeling journalists who criticize him “the enemies” of the American people. He has picked on the courts, calling a respected federal judge a “so-called judge.” And he has ignored values of equality that are central to a pluralistic, rights-based democracy.

Trump and many of his associates have repeatedly railed against immigrants, Muslims, and the Movement for Black Lives. Attorney General Jeff Sessions — who seems to have played a key role in pushing Comey out the door — is actively going after immigrants already, and talking about doubling down on a war on drugs that has already had a grossly disproportionate impact on black people, even as he seems poised to roll back civil rights protections.

The firing may already be harming the public’s trust in the system, which depends not only on following the law, but also on its behavior or culture. Whatever now happens substantively in terms of the Russia investigation, or others, Trump’s conduct — the implausible explanations, the clear linkage to his anger over the Russia file, his calls to Comey — put that delicate trust in real jeopardy.

Finally, the firing means Trump will get to nominate someone who shares his views, and who may be willing to use the tremendous power of the FBI to pursue a political or discriminatory agenda.

What will an FBI in the hands of someone who shares that agenda do? What will it do with the massive trove of intelligence surveillance information in its hands? Will it return to the persecution and dirty tricks of the Hoover days?

It’s now up to the Senate to prevent that from happening. This is not, or should not be, a partisan issue. The country’s legitimacy as a rights-respecting democracy, at home and abroad, is at stake. The rule of law is in peril. It’s up to both Democrats and Republicans in the Senate to protect it, and rebuild public trust.

Part of that means ensuring the continuation and independence of investigations into the Trump campaign. But there’s more at stake than the Russia investigations. The bigger question is whether Trump will be given the opportunity, through nominations and lack of effective oversight, to remake the FBI as an agency that is accountable only to him, rather than to the people and the Constitution.

The rule of law is not a monolith, but a product of a complex interplay of forces. It is not, in large, mature democracies, overturned at a stroke, but damaged by degrees, and we must be alert and resistant to the threat it now faces.

Maria McFarland Sánchez-Moreno is co-director of the US Program at Human Rights Watch, where she guides the organization’s work on criminal justice, drug policy, immigration, national security, and surveillance in the United States.

First Person is Vox's home for compelling, provocative narrative essays. Do you have a story to share? Read our submission guidelines, and pitch us at firstperson@vox.com.