MINSK, Belarus (AP) — Russia and Ukraine have agreed to continue sending gas through Ukraine to Europe for five years.

The decision that was announced Saturday removes worries that Europe could be denied a substantial amount of the Russian gas that it relies on for heating and industry.

Russia ships about 40 percent of its European gas deliveries through pipelines that cross Ukraine. The current contract is to expire at the end of the year and delays in concluding a new one caused concern in Europe.

Officials in the Russian and Ukrainian capitals said they plan to have the new contract signed before New Year’s Day.

Ukrainian Energy Minister Alexei Orzhel told reporters on Saturday that the agreement foresees shipments of 65 billion cubic meters through Ukraine in 2020 and annual shipments of 40 billion cubic meters thereafter.

Those amounts are smaller than what Russia has sent through Ukraine in previous years. Russia has been working intensively to build new delivery networks that bypass Ukraine.

Those networks include the under-construction Nord Stream 2 undersea pipeline between Russia and Germany, whose immediate future has been thrown into doubt after the company laying sections of the pipeline said it is suspending work because of U.S. legislation threatening sanctions.

The Ukraine-Russia deal also includes payment by Russia of $2.9 billion to settle an arbitration claim arising from previous transit disputes, and waives new claims, said Alexei Miller, head of Russia’s state natural gas monopoly, Gazprom.