VLADIMIR PUTIN, Russia’s president, rarely visits the European Union these days. When he does, it is unclear whether he wishes to mend fences or issue threats. During a visit on July 1st to Finland, which has a 1,340km (883-mile) border with Russia, Mr Putin did both: he made reassurance sound like a threat. Even as NATO was running military drills in the Baltics and preparing for its summit in Warsaw on July 8th, Mr Putin told his Finnish counterpart, Sauli Niinisto, that he considered Finland a “priority” partner for Russia, spoke of “friendship”—and advised him to keep out of NATO and even follow Britain out of the European Union. Coming from a revisionist Russian leader, the word “friendship” has a menacing echo in Finland. After Stalin’s unsuccessful attempts to invade Finland in 1939, 1940 and 1944, the Soviet Union in 1948 imposed a “Friendship Treaty” which limited Finnish sovereignty. It was only abandoned in 1992. But while Finland later joined the EU, it stayed out of NATO—something that many Finns now regret. Mr Putin’s military interventions in Georgia in 2008 and Ukraine in 2014 have overturned the post-cold war order. Now he wants to impress on Finland that the security of its borders depends on Russia.

It is not just empty rhetoric. Late last year, Russia allowed some 2,000 asylum-seekers of various nationalities through its side of a checkpoint, forcing the Finns to admit them lest they be trapped in no-man’s land. Given how tightly Russia controls its checkpoints, Finnish officials concluded that the Kremlin was sending a signal that it could respond to any move to join NATO by asymmetrical means. Teija Tiilikainen, director of the Finnish Institute of International Affairs, says it “looked like part of a Russian ‘hybrid action’”—the Russian strategy of using non-military methods to achieve military goals. Finland has also been subject to Russian cyber-attacks.

Perhaps Mr Putin’s most threatening statement was his claim that Russia had “no troops stationed closer than 1,500km from the Finnish border”. (This was a gaffe; while Russian troops are not concentrated on the long stretch of the border, its new Arctic Brigade is stationed a few kilometres from Finnish Lapland.) If Finland were to join the alliance, Mr Putin warned, Russia would bring its troops back. “NATO would probably be happy to fight Russia to the last Finnish soldier,” he quipped.

Sweden, too, has remained militarily neutral and refrained from joining NATO, though it enjoyed secret American guarantees of protection during the cold war. But Russia’s menacing posture is now driving Finland and Sweden to deepen their military co-operation, and sparking debate in both countries about joining NATO. Sergei Lavrov, Russia’s foreign minister, helped prod the debate during a visit to Helsinki in June by saying that Russia “will never attack a member state of NATO”—hardly reassuring for non-NATO countries.

Finland does not think Russia will attack it, not least because of Finland’s military strength. But it is nervous about an accidental escalation, or a spillover of the rising tension in the Baltics. NATO has been beefing up its presence there; it is particularly worried about the Suwalki Gap, a 100km stretch along the Polish-Lithuanian border between Belarus and the Russian exclave of Kaliningrad. The gap is currently guarded by a Polish anti-tank artillery squadron equipped with outdated Soviet-era arms. A Russian thrust through to Kaliningrad would cut off overland access from western Europe to the Baltics.

“At present the Baltic states are effectively indefensible,” says François Heisbourg of the International Institute for Strategic Studies, a think-tank. If Russia takes the gap, the only way to supply them would be through Sweden and Finland.

Finland knows that joining NATO would be seen as a red line by Moscow, and might provoke an asymmetrical response. Mr Niinisto has promised to hold a referendum on NATO membership should the government decide to favour it. At present, public opinion would most likely be against it. But this could change if Sweden, Finland’s closest ally, were to join.

In the meantime, Finland’s policy consists of discussing NATO membership and improving its ties and deepening its bilateral military relationship with America, all while trying to maintain a special relationship with Russia. (Mr Niinisto was the first European leader to fly to Sochi to meet Mr Putin after Russia’s seizure of Crimea, a step which raised many eyebrows in Europe.) Finland considers the possibility of joining NATO to be a tool of deterrence. But as Jukka Salovaara, a senior Finnish diplomat, says: “If the situation deteriorated quickly, there would be no time to apply.”

Finland is justifiably proud of handling its difficult eastern neighbour while transforming itself into a prosperous Western country, with one of the strongest territorial armies in Europe. But what worked against the Soviet Union may not work against Russia, which has made an art of unpredictability and “asymmetrical” action. The risk is Russia may interpret Finland’s ambiguity as a sign of hesitance and weakness rather than strength.

It was when NATO failed to offer Georgia a membership action plan in 2008, but left the door open, that Russia struck. Shortly thereafter, a joke started making the rounds in Finland. Vladimir Putin lands at Helsinki airport and proceeds to passport control. “Name?” asks the border guard. “Vladimir Vladimirovich Putin,” answers the Russian president. “Occupation?” asks the border guard. “No, just visiting,” answers Mr Putin. After Ukraine, says Risto Penttila, a Finnish policy expert, people stopped laughing.