Support for this article was provided by a grant from the Pulitzer Center on Crisis Reporting.

KYIV, Ukraine—“Everything,” Dmytro Zolotukhin tells me, “is going like they wanted.”

Slumped in a chair in a café here in the Ukrainian capital, Zolotukhin wasn’t talking about the campaign of Volodymyr Zelensky, a comedian who is favored to win the country’s presidential elections this weekend, or the incumbent, Petro Poroshenko. No, they are the Russians. Moscow has used Ukraine as a disinformation laboratory for years—and Zolotukhin is one of the men charged with fending them off.

The Kremlin stands accused of interfering in elections the world over, driving division in societies through an array of tactics, chief among them online disinformation. Using fabricated or misleading news stories and fake accounts, Russian operations have sought to sow doubt in the democratic process. Ahead of European Parliament elections next month and the American presidential contest in 2020, Putin’s online armies are auditioning their tactics in Ukraine.

Kyiv isn’t just the laboratory for Russia’s information warfare tactics, though; it’s also a proving ground for possible solutions, where officials such as Zolotukhin, Ukraine’s deputy minister of information policy, struggle to walk the line between defending democratic discourse and trampling freedom of speech. As the United States prepares for another contentious presidential race and social-media regulation looks inevitable, the Ukrainian government’s efforts highlight how difficult it is to fight disinformation in a polarized information environment.

But offices such as Zolotukhin’s are often under-resourced, and in a divisive electoral period in which campaigns are themselves combatants in the information war, separating fact from fiction, patriot from enemy, and friend from foe is not as simple as it once was.

The Ministry of Information Policy (MIP) sits at the top of a Soviet-era building just off Khreshchatyk, Kyiv’s sweeping main boulevard, where relics of czarism and communism mix with more eclectic modern architecture. Founded in 2015, the ministry is charged with protecting Ukraine’s information space. Its logo, the state seal adorned with four USB cords, makes clear where the government sees the biggest threat: online.

I first became acquainted with Zolotukhin and the MIP when I worked as a strategic communications adviser to Ukraine’s Foreign Ministry in 2016. The MIP was created in response to an onslaught of fake news from Russia, and one of its stated objectives is to “counteract ... informational aggression”—Moscow has been blamed for ongoing disinformation campaigns in Ukraine, including during the Euromaidan protests in 2013 and when Russia annexed Crimea from Ukraine the following year. Yet the ministry is also charged with protecting freedom of speech, a duty that at times has placed it in contradiction with itself.

Unlike Washington, which has mustered hardly any official response to Russia’s use of disinformation to influence the 2016 presidential election, Kyiv has taken action. In May 2017, Poroshenko banned the Russian search engine Yandex and the social-media networks VKontakte and Odnoklassniki within Ukraine, a decision backed by the MIP. A year later, the government blocked an additional 192 websites that supposedly had pro-Russian sympathies, relying on the MIP’s advice to compile the list. The bans have, in one sense, served their purpose; officials say that overt Russian-originated disinformation has decreased. Yet as Zolotukhin alluded to in his conversations with me, that has not meant Moscow’s goals have not been met.

In response, Ukraine has been accused—by allies as well as critics—of pushing the boundaries of acceptable democratic behavior. “We received immediate feedback from all of our partners, saying, ‘Well, this is an attack on free speech and attack on free expression,’” Ivanna Klympush-Tsintsadze, Ukraine’s deputy prime minister for Euro-Atlantic and European integration, told me. “We had a really hard time explaining to our partners … don’t forget that we are a country at war. We are losing people every other day, if not every single day.”

The situation has only become more delicate during the election period—Zelensky and Poroshenko were the top-two vote-getters after the first round of polling last month and are employing dirty outreach tactics ahead of Sunday’s final round. “If you see a certain story in Ukrainian media,” Zolotukhin tells me, “now you absolutely do not have any basis to call it a Russian narrative, because usually it’s a certain position that is being supported by some number of Ukrainians.” In 2014, Russian trolls attempted to spread outright fake stories. In 2019, disinformation is more grounded in the issues at the heart of this election: corruption, quality of life, and assessments of Ukraine’s progress since Euromaidan.

Overstressed, overworked staff members of both the Poroshenko and Zelensky campaigns demonstrate how ripe for exploitation the Ukrainian electoral environment is. At the headquarters of Poroshenko’s political party, Solidarity, one of his advisers, Dinara Habıbullaieva, shows me around an “exhibition of fakes” shared by Poroshenko opponents that the campaign curated for the election’s first round.

Some of the examples, which were mostly created within Ukraine but stem from Russian narratives, are laughably false, such as a report aired by the television channel 1+1 (where Zelensky’s comedy programs air) that claims Poroshenko murdered his brother. A few exaggerate known fissures in Ukrainian society, such as anti-Semitism or Russian-language policies. And others are simply misleading while being politically inconvenient, such as a story claiming that Poroshenko owns a chocolate factory in Russia (he does own a chocolate company, but closed its Russian outpost in 2017).

Zelensky’s team claims that it has also been the subject of an intense disinformation campaign. Since he announced his candidacy three months ago, his digital team has been fighting off a legion of bots spamming the comments on their posts and inauthentic accounts posing as official campaign representatives. Mikhail Fedorov, Zelensky’s chief digital strategist, is hesitant to point the finger at Russia, however, instead blaming Poroshenko’s supporters.

According to Fedorov, the Zelensky campaign found little support when it reached out to Facebook and Google for help; its account on YouTube (which is owned by Google) was suspended after inauthentic reports about its content triggered the platform’s automatic-shutdown algorithm, and Facebook had no dedicated Ukrainian employee for any of the campaigns to contact. So it crowdsourced the fight against fakes through a chat bot that reports and addresses disinformation about the campaign as it appears. (One story to which the campaign attached the “fake” label, however, probably wasn’t: A group of Ukrainian investigative journalists turned up an Italian villa that had not appeared on Zelensky’s asset declaration.)

Still, when I was at Zelensky’s campaign headquarters on the night of the first round of elections, amid Ping-Pong tables and no fewer than 100 bottles of wine and champagne, according to the bartenders on hand, his team was confident that it had triumphed over disinformation, for now. An exhausted Fedorov reported that the campaign’s crowdsourcing operation worked extremely well, neutralizing fakes within minutes, and that Facebook eventually reached out to Zelensky’s staffers after The New York Times published an article on the campaign’s struggles.

The confusion and chaos present a conundrum for Zolotukhin and his MIP colleagues, who can stand accused of favoring Poroshenko. Zolotukhin has deliberately disengaged from his public outreach work: Trying to set the record straight in these politically charged situations has gotten him in trouble in the past. Poroshenko himself is blurring the line. After a far-right protest criticized his administration over a recent defense-sector corruption scandal, Poroshenko claimed that the groups were Putin’s “messengers.”

Like most other members of the government, Zolotukhin bristles when I ask him about the threat such actions might pose to freedom of speech in Ukraine. What use is democracy, he asks, if a commitment to freedom of speech is used to defend lies?

Zolotukhin’s question gets at the heart of the debate. When Facebook first faced criticism for its role in spreading disinformation, it pushed back at requests for content moderation, saying it did not want to be “the arbiter of truth.” Now, as social-media scandals around the globe have mounted and platforms relent to the advance of regulation, governments face a choice. They can pursue heavy-handed, overarching bans based on subjective definitions of truth. Or they can craft selective, careful, and transparent regulation that affects only the most harmful content, and leave citizens to navigate the pitfalls of the 21st-century media environment.

Kyiv is trying to do both. Along with Zolotukhin’s efforts, Ukraine’s Parliament is considering two draft laws that would criminalize the “dissemination of false information” and introduce temporary bans on outlets spreading disinformation during election periods, as well as further empower the government to block websites it considers a threat to national security. At the same time, the authorities are investing in critical thinking and media-literacy programs that have seen success: Students exposed to a training program implemented by the Ukrainian Ministry of Education in partnership with an American NGO, IREX, were twice as likely to be able to identify hate speech and 18 percent more likely to spot disinformation than were peers who did not go through the program. The significance of these achievements, however, will be in doubt if the government ushers in an era of political censorship in the name of countering Russian information warfare.

With days remaining before Ukraine’s vote, whoever wins the presidency will inherit a dangerous amount of power over the country’s information space. In an era in which world leaders increasingly label political opponents and the press “enemies of the people,” Ukraine is attempting to answer the existential questions Zolotukhin poses. Pointing to the debate’s relevance in Washington, he asks, “Does the First Amendment give citizens rights to lie freely, to do this publicly, and to do this massively? Not just to be one voice in a crowd, but to invest millions of dollars in this stuff and to spread lies for millions of people?”

“Did the Founding Fathers,” he continues, “when they thought about these amendments, did they think about this?”