BRUSSELS/VILNIUS (Reuters) - The leaders of the Baltic states and Poland signed a long-awaited deal on Thursday to connect their power grids to the European Union by 2025 and break their dependence on Russia, a Soviet legacy.

Estonian Prime Minister Juri Ratas, Lithuanian President Dalia Grybauskaite, European Commission President Jean-Claude Juncker, Latvian Prime minister Maris Kucinskis and Polish Prime Minister Mateusz Morawiecki sign a deal to connect their power grids to the European Union grid by 2025 and break their dependence on Russia, a Soviet legacy, in Brussels, Belgium June 28, 2018. Julien Warnand/Pool via REUTERS

Nearly ten years in the making, the politically fraught, technically challenging and costly plan to unplug Estonia, Latvia and Lithuania from Russia comes amid mounting concerns over Russian posturing in the region.

The Baltic States, once ruled from Moscow but members of the European Union and NATO since 2004, view being linked into Russia’s power network as a threat to their national security.

The agreement, seen by Reuters, was signed with the EU’s chief executive, Jean-Claude Juncker, on the sidelines of a summit of EU leaders in Brussels.

It ends years of bickering among the three countries over how best to synchronize their electricity grid with the Continental Synchronous Area of their partners to the west and paves the way for EU funds to be disbursed for the 1 billion euro project.

“We worked nine years for the agreement,” President Dalia Grybauskaite told Lithuanian LRT television on Thursday.

“This is the last millstone tied to our feet, keeping us from real energy independence,” she said. “That tool of blackmail, which was used (by Russia) to buy our politicians and meddle in our politics, will no longer exist.”

Approaching deadlines to tap into EU funding for the project, as well as upgrades to the Russian network which give the former overlord an apparent ability to decouple the Baltics unilaterally, forced the sides to work out a solution.

Under the deal, states would use the existing overland LitPol Link between Lithuania and Poland, as well as a new high-voltage direct current cable to run under the Baltic Sea, looping around the territorial waters of Russia’s Kaliningrad exclave.

This project, to be confirmed by August, would cost around 560 million euros, a diplomatic source said.

“I think this as a historic event which helps to finally solve the question of the energy independence of the Baltic States,” Latvian Minister of Economics Arvils Aseradens told Reuters.

The underwater cable will offer 700 megawatts (MW) capacity and could be completed by 2025, Lithuania’s Energy minister Zygimantas Vaiciunas told Reuters.

It will be used both for power trading and synchronization purposes, he added.

Brussels is to negotiate with Moscow over how to maintain the power supply to Kaliningrad, which is currently synchronized with mainland Russia through the Baltic states. The deal proposes connecting Kaliningrad with two back-to-back power converters.

Russia, on which the Baltic states currently rely to balance their power flows, has never cut power or threatened to do so, but the three EU nations fear it might and say there is a lack of transparency on upkeep of the network in Russia.

Lithuania expects Baltic states to test their ability to work autonomously from Moscow in June 2019, before formally switching by 2025.

The Russian and Continental European systems both operate at a frequency of 50 Hertz, but are not synchronized. The Russian system is run from Moscow, whereas the continental one is decentralized.

(Fixes typo.)