Belarusian President Alexander Lukashenko is an expert at political maneuvering, even by the standards of the colorful post-Soviet states. On the one hand, he is able to distance himself from Moscow on a string of sensitive political issues. On the other, he can always come up with new arguments for receiving Russian financial aid.

The turmoil in Ukraine has led Lukashenko to take on a careful balancing act. He has not only positioned himself between the feuding Russians and Ukrainians, but also managed to weave a course between his old allies to the east and his would-be friends to the west.

As early as 2008, Lukashenko began gravitating westward when he refused to recognize the Moscow-backed separatist regions of South Ossetia and Abkhazia. But in the aftermath of the Ukrainian crisis, Belarus’s pro-European foreign policy has become even more pronounced.

Since then, Minsk has maintained and even improved its relations with Kiev. First, Lukashenko met with then acting president Oleksandr Turchynov; then, he attended the inauguration of President Petro Poroshenko.

Belarus’s leadership has chosen not to comment on the self-proclaimed people’s republics of Donetsk and Luhansk. And while Lukashenko has acknowledged the sovereignty of Crimea as a “fact on the ground,” he has deliberately avoided any questions on its legality.

Belarus has not joined Russia’s counter-sanctions against the West. As a result, it has become a transit hub for sanctioned goods.

Minsk has also become the alternative route for flights that used to travel from Russia to Ukraine, Egypt, and Turkey. Russian planes stopped flying to Egypt after terrorists blew up a passenger plane returning from the resort city of Sharm el-Sheikh to Russia in October 2015. And holiday charter flights between Russia and Turkey were halted after Turkish officers shot down a Russian military plane in November last year that had entered Turkish airspace.

Even that incident prompted an unusually measured response from Minsk, a lengthy statement urging “brotherly Russia” and “friendly Turkey” to remain calm.

Perhaps most fundamentally, Lukashenko has managed to put off questions about building a Russian air base in his country, despite Moscow’s persistent and public pleas. Constructing a Russian military base in Belarus would inevitably put an end to the thaw in Belarus’s relations with the European Union. Lukashenko has sharply rejected Russia’s entreaties, saying he never agreed to or even discussed the opening of a military base.

The maneuvering appears to have paid off: the EU has lifted sanctions from Minsk as a token of gratitude for Belarus’s relative neutrality on Ukraine, the release of political prisoners, and the unexpected lack of violence in recent elections.

But Belarus’s dire economy puts a different spin on any foreign policy successes. Russia’s economic decline and the collapse in oil prices have had an adverse effect on the Belarusian economy.

Russia’s 3.7 percent fall in GDP in 2015 precipitated a 3.9 percent drop in Belarus’s GDP. The price of oil products, Belarus’s main export item, has declined and Belarus now makes far fewer sales to the sagging Russian market. The devaluation of the Russian ruble triggered a spontaneous devaluation of the Belarusian ruble.

Unlike Russia, Belarus lacks sufficient currency reserves to maintain macroeconomic stability without cash injections from the outside, which is why Minsk has been negotiating new loans from the IMF and its Eurasian counterpart, the Eurasian Fund for Stabilization and Development.

But while IMF loans depend on the borrower’s willingness to comply with economic reforms, the Eurasian credit is mostly about politics. The IMF has repeatedly postponed its final decision, and it seemed that Moscow would also hold off in response to its partner’s unruly behavior. However, the new loan has been approved, and both sides signed the agreement on March 28.

Some observers say the deal must mean that Lukashenko agreed to major concessions put forward by the Russian president at their closed-door meeting on February 25. But this doesn’t seem to be the case.

Rather, it looks like the time-tested scenario in Russian-Belarusian relations: when Minsk is in a bind, the Kremlin decides not to risk losing its wayward ally and finds an accommodation with Lukashenko instead.

This pattern has worked like a dream under the three Russian presidents beside whom Lukashenko has served. His ability to align himself correctly ensures its success. Even during emotional conflicts, he turns out to be the least of all evils for Russia and he always manages to tip the scales in his favor.

Here’s how he does it: firstly, ever since the 1990s, he’s been trying to address the Russian people directly. Back then, at the dawn of his career, many observers had every reason to believe he would accelerate a union between Russia and Belarus and then take over the unified state after then Russian president Boris Yeltsin’s retirement. While this ambitious initiative failed—if it ever existed—Lukashenko has continued to improve his image in the eyes of the Russian people.

Every year, groups of journalists from Russia’s regions are invited to visit Belarus. They tour the country’s best collective farms and factories, spend hours talking to the president, and come home in high spirits to tell the story of the Belarusian miracle.

Of course, the Kremlin propaganda machine could reduce the Russian people’s support for Lukashenko, if necessary. It would be hard to portray this Russian-speaking, anti-Western manager as an American puppet, the way Ukrainian leaders were, but in the last few years Russia’s state-sponsored media outlets have proven themselves capable of twisting the truth.

This is not the main issue, though. For a smear campaign to be successful, the Kremlin needs to find an alternative to Lukashenko on the Belarusian political field. Despite its authoritarian regime, Belarus does have a legally functioning opposition and a range of political parties. But these are all oriented towards the West. Belarus simply doesn’t have pro-Russian opposition forces, although, according to the latest polls, as many as 25 percent of Belarusians want to strengthen their country’s integration with Russia, including possibly joining their eastern neighbor, and almost two-thirds of Belarusians believe that the Crimean annexation was just.

It’s true that the Russian president doesn’t like his Belarusian counterpart on a personal level. But not giving him money at this critical juncture would mean jeopardizing the stability of the Belarusian economy and, by extension, its political system.

Finally, the deterioration in Moscow’s relations with many of its longtime partners has become another factor in cementing the Russian-Belarusian friendship. Belarus has always been Russia’s closest ally, but it may now become its only ally. It may also be the only stable supply route for Russia’s hydrocarbon exports to Europe. In this context, $2 billion is not such a large price to pay.