Russia and Ukraine announced terms of a new gas transit deal on Saturday, under which Moscow will supply Europe for at least another five years via its former Soviet neighbor and pay a $2.9 billion settlement to Kiev to end a legal dispute.

The deal is a major breakthrough for both countries, which have been seeking to resolve disputes over Ukraine’s eastern Donbass region and the Crimea peninsula, which Russia annexed in 2014.

Under the new agreement, Russia‘s Gazprom, which supplies over a third of Europe’s gas needs, would use an agent to book the transit of 225 billion cubic meters (bcm) of the fuel via Ukraine over five years.

Of the total, 65 bcm would be shipped in 2020, falling to 40 bcm in 2021 and in each of the subsequent years, Gazprom said.

The Russian gas company would also pay Ukraine the $2.9 billion before Dec. 29, in line with the amount proposed in arbitration rulings between Gazprom and Ukrainian energy firm Naftogaz in 2018.

In exchange, Ukraine is expected to sign a legal settlement and withdraw all outstanding claims, also before Dec. 29, aiming to resolve the issue before the existing supply deal expires.

Russia‘s Gazprom and Ukraine’s Naftogaz had gone to an arbitration court in Stockholm in a number of disputes over gas prices and transit fees dating back to 2014.

The presidents of Russia and Ukraine met in Paris on Dec. 9 to discuss options for a settlement over Donbass and terms for the new gas transit deal. The talks, known as the Normandy summit, were brokered by France and Germany.

Ukrainian Energy Minister Oleksiy Orzhel said on Saturday that under the new deal both parties had an option to extend the five-year term by another 10 years. He added that the transmission tariff for the Russian gas would rise.

The deal comes as U.S. President Donald Trump signed legislation on Friday that included provisions to impose sanctions on companies laying pipe for Nord Stream 2, a project that aims to double gas capacity from Russia along the northern Nord Stream 1 pipeline route to Germany.

Nord Stream 2, which will run along the Baltic sea floor, will enable Russia to bypass Ukraine and Poland to deliver gas.

The group behind Nord Stream 2 said on Saturday it aimed to complete the pipeline as soon as possible, after a major contractor suspended pipe-laying activities due to the U.S. sanctions.