Russia has lots of oil, but in a weird twist of fate, the nation could soon run dangerously low on gasoline.

The head of Russia's biggest oil company is warning that the world's second largest oil producing nation could soon face a fuel shortfall.

Rosneft's Igor Sechin predicts that Russia's gasoline shortage could reach 5 million tonnes a year by 2017. It produced around 38 million tonnes of gasoline in 2014, according to the energy ministry.

The expected shortfall is a result of many factors, including new tax rules, a weakening economy and Western sanctions that are hurting Russia's oil refining businesses. This is pushing fuel prices up, even as oil prices have plunged.

Gasoline prices rose 6.3% in the first half of the year, according to official data.

In a letter sent to Russian President Vladimir Putin and quoted by local media this week, Sechin urged Putin to address the issue by introducing benefits for oil refineries. He said this would boost investment in the industry and increase efficiency.

Related: How badly have sanctions hit Russia?

New Russian tax rules, which were introduced in January, are exacerbating the situation. They were designed to make it cheaper to export crude oil, while raising taxes on refined oil exporters and miners.

The move was meant to split the tax burden more evenly across the energy and mining sectors and give a boost to crude exporters. But the change ultimately made crude oil more expensive for domestic refineries, causing their profits to drop.

"Lower global prices for oil and oil products, along with the significant depreciation of the ruble, mean that [the tax policy's] effect could well differ significantly from what was initially planned," wrote Dmitry Loukashov, a chief oil and gas analyst at VTB.

Oil prices have dropped from around $107 a barrel last June to $44 right now, weighing down Russia's oil-dependent economy.

The refineries are also hurting because of Western sanctions, which are preventing them from using critical foreign technology.