Reality Winner, a 25-year-old employee of a contractor that does work for the NSA, was arrested in June and charged with transmitting classified information, widely suspected to be an intelligence document about Russian interference in the 2016 U.S. presidential election that was published by The Intercept. The precise facts surrounding her actions, and their consequences (if any), would come out in a fair trial—but unfortunately, she won’t have a fair trial because she’s being prosecuted under the 1917 Espionage Act.

The Espionage Act is a fundamentally unfair and unconstitutional law. As the ACLU argued in an amicus brief in the Chelsea Manning appeal, and has argued with reference to Edward Snowden, this act is unconstitutionally vague because it allows the government to prosecute leakers and whistleblowers that it dislikes, while leaving untouched the many leakers within the security state who release classified materials to advance those agencies’ bureaucratic aims. Perhaps worse, it doesn’t allow leakers to defend their leaks by trying to demonstrate in court that they served the public interest. As my colleagues Dror Ladin and Esha Bhandari have detailed, that is how a whistleblower like Chelsea Manning ended up with a 35-year prison sentence (later commuted by President Obama, but still imprisoned for 7 years).

Many people worry about a world where any twentysomething serving in government feels they can unilaterally declassify the nation’s secrets without consequences. At the same time, in a context where the out-of-control national security state has abused its secrecy powers in profoundly undemocratic ways, individual leakers throughout our history have provided valuable services to our democracy, including but by no means limited to Daniel Ellsberg and his release of the Pentagon Papers, which revealed profound government lying to the public about the Vietnam War. Whistleblowers are an important check and balance in our democracy.

Nobody is saying that leakers should never face consequences for their actions. But as the actions of people like Reality Winner are evaluated in court, that process must, as my colleague Ben Wizner has argued, respect principles such as:

Leakers should not be punished more severely than the wrongdoers they expose.

Leakers must be permitted to argue that the benefit of leaks to the public and our democracy outweigh any alleged security harms.

Leaks of information that reveals government fraud, corruption, or illegal activities must not be prosecuted at all.

The government must prove that it was actually justified in withholding the leaked information from the public it serves, at a cost to our democracy, by classifying it.

The government must not prosecute its critics while looking the other way when it comes to leakers who are friendly to the bureaucratic aims of various agencies.

As it stands, the Espionage Act makes NO distinction between a civic-minded whistleblower who releases something that should never have been classified and which reveals illegal government activities, and a spy who sells genuinely damaging documents to a foreign government for cash.

The blunt unfairness of the Espionage Act reflects its awful history. It was passed by Congress in June 1917, just two months after the United States entered World War 1, at a time of war fever, hyper-nationalism, repression of anti-war views, and the early stages of the First Red Scare. The original law was expanded by Congress in May 1918 through the Sedition Act to cover a sweeping range of offenses. That act made it a crime to engage in “disloyal, profane, scurrilous, or abusive language” directed at the U.S. government, its armed forces, or the flag, or to “advocate, teach, defend, or suggest the doing of” various acts including “curtailment of production.”

In this era people were literally being thrown in prison just for writing letters to the editor. The Espionage and Sedition Acts were vigorously used by Woodrow Wilson’s Attorney General A. Mitchell Palmer and his young aide, a 24-year-old J. Edgar Hoover, to persecute left-wing activists and critics, and were integral to the Red Scare, including the violent Palmer Raids several years later in which ten thousand non-citizens were arrested and hundreds deported based on their political views and membership in organizations.

The Red Scare wound down in 1920, and Congress repealed the Sedition Act that year—but not the rest of the Espionage Act, which remains with us today, and in its fundamental bluntness and unfairness reflects the terrible time in which it was crafted.

As bad as it was, the Espionage Act lay dormant for many years. As my former colleague Gabe Rottman has laid out, before 2010 there were only four leakers prosecuted under the Espionage Act: two who had their charges dropped, one who was pardoned by President Clinton, and one who was sentenced to 10 months at a halfway house and 100 hours of community service. Beginning in 2010, however, eight have been charged under the act, including Chelsea Manning (sentenced to 35 years), Edward Snowden, and four others who received sentences of 13, 20, 30, and 43 months, respectively.

Now Winner has become the subject of the ninth Espionage Act prosecution, and is facing a sentence of 10 years in prison. She should have the right to have her case heard in accordance with the principles outlined above. The Espionage Act needs to be repealed and replaced with a fairer law.