Belarus is often called Europe’s last dictatorship, and its president, Alexander Lukashenko, heads an authoritarian government that’s highly reliant on Russia. He also kicked out the U.S. ambassador more than 10 years ago. In other words, it’s just about the last place you might expect to see a U.S. Secretary of State. And yet, there Mike Pompeo was earlier this month. The question is, why?

The Kremlin sees Belarus, just to the north of Ukraine and on Russia’s western border, as firmly in its sphere of influence, and Russian President Vladimir Putin has angled to tighten the two states’ already-tight bonds—sowing fears that he aims to claim it as part of Russia itself.

For much of the country’s short history, its relationship with the U.S. has been quite bad. The U.S. sanctioned Belarus in 2006 after an election that the State Department called “neither free nor fair.” And in 2008, the country expelled the U.S. ambassador and capped the number of diplomats allowed there at five.

Then Putin invaded Ukraine. And a delicate diplomatic dance began—one that continued over two American administrations, headed by presidents with extremely different attitudes towards Putin. (The Belarusian Ministry of Foreign Affairs did not respond to a request for comment for this story.)

According to multiple current and former U.S. officials, Lukashenko responded to Russia’s annexation of the Crimean Peninsula by signaling to the U.S. that he wanted closer ties. Michael Carpenter, who worked on Eurasia policy as Deputy Assistant Secretary of Defense during the Obama administration, told The Daily Beast that Lukashenko sent the message loud and clear when the two of them had a two-hour meeting in March 2016.

“We spent almost half of it talking about Ukraine,” Carpenter said. “It was just very apparent to me at the time that this was a huge preoccupation for him, that he was very worried about the implications of what that meant for his own country.”

In the years since then, the Belarussians have kept signaling to the U.S. that they want a warmer relationship. And Americans have signaled back. One senior State Department official said Wess Mitchell—assistant secretary of state for European and Eurasian Affairs from 2017 to 2019—made clear to the Belarusians that things could change. The official said Mitchell’s involvement was like a hinge: If Belarus was serious, he communicated, then the U.S. was serious too. During the Trump administration, a battery of senior officials went to Minsk to meet with officials there, including Mitchell, Under Secretary of State for Political Affairs David Hale, and then-National Security Advisor John Bolton.

For years, per one former U.S. official, the U.S. government had seen Belarus as a lost cause.

“We took for granted that Belarus was going to be frozen in time as a Soviet theme park,” the former official said—adding that the last several years proved that assumption wrong.

The appearance in Minsk by Bolton—a very open Russia hawk—was especially notable.

“From my view, Bolton was there precisely to address concerns about Russian aggression,” said Jonathan Katz, who oversaw U.S. assistance to Belarus at USAID under the Obama administration.

In 2017 and 2018, there were substantial quiet conversations between U.S. and Belarussian officials, according to two congressional aides familiar with the Trump administration’s policy toward the former Soviet republic. They signaled they feared for their own viability as a nation in the face of potential Russian incursions, per the aides. In 2017, Lukashenko invited American officials to observe major Russian military exercises held there––a move that impressed the Hill. And in January 2019, the Belarussians lifted a cap on how many American diplomats can work in the country. One State official said they expect the number of diplomats there to double by 2021.

And over the last year, per the Hill aides, Belarussian officials have reached out to Congress about efforts to warm the relationship.

The efforts culminated in a historic visit to Belarus earlier this month by Secretary of State Mike Pompeo. The State officials said Belarus’s state oil company signed a framework agreement with a North Dakota oil trading firm to buy up to 18 million barrels of U.S. oil in 2020. The deal didn’t include details and may not come to fruition. But it sent a signal to the Kremlin: Belarus doesn’t want Russia to be its one-stop-shop for energy.

The Kremlin’s response, per the two senior State officials, was predictable: an onslaught of disinformation about the trip and its significance (“Netizens Implicate Mike Pompeo in Fresh Anti-Belarus ‘Extortion Scheme’ Before Historic Minsk Trip,” blared one headline on the Kremlin-controlled Sputnik News).

Moscow’s apparent irritation wasn’t surprising. While President Donald Trump and Putin are famously chummy, the Trump administration’s policies have often been borderline hostile towards the Kremlin. The Belarus overtures, meanwhile, are of a piece with the administration’s national security strategy, which calls for focusing on competition with great powers including Russia and China. The former U.S. official said the Belarus outreach isn’t an outlier. Throughout Eastern Europe, the Caucasus, and the Balkans, the U.S. is pushing back on Russian influence in similar ways, the official said.

“It’s not lost on the leaders in Minsk that they potentially in the very near term face a similar type of situation to that Ukraine has faced,” Katz said, “and I think this is changing the calculation even of an aged authoritarian who’s been in power several decades.”