The European Union, Ukraine, and Russia have agreed on an interim solution for natural-gas flows that could prevent energy shortages in both Ukraine and EU countries this winter.

Speaking after a trilateral meeting in Berlin, EU Energy Commissioner Guenther Oettinger said Ukraine must pay $2 billion to Russia by the end of October and another $1.1 billion at the end of the year for outstanding bills.

Oettinger, who held the talks with Russian Energy Minister Aleksandr Novak and Ukrainian Minister of Energy and Coal Industry Yuriy Prodan, said the EU believes "this is an acceptable interim solution to ensure the supply of gas next winter and until spring."

He said both Ukrainian and Russian officials would have to discuss the proposed agreement with their respective governments.

"We have made a lot of headway," Novak said.

However, Prodan said there was no agreement with Russia yet over the gas price.

"Unfortunately, we have not agreed on the price-formation mechanism with Russia," Prodan said.

On September 27, Ukraine's Naftogaz state energy firm chief Andriy Kobolev vowed to keep fighting over both the gas price and Moscow's claim that Kyiv owed it billions of dollars in debt.

Kobolev wrote in a Facebook post, "No final decision was adopted. Not a single document was signed -- period."

Also on September 27, Novak told Rossiya 24 television that the three sides would meet again on October 2 or 3 to settle the dispute.

Under the proposed deal, if Moscow receives the $2 billion at the end of October plus a prepayment for new gas at $385 per 1,000 cubic meters of gas, Russia will deliver 5 billion cubic meters of gas to Ukraine.

Prodan said Ukraine still opposes the $385 price, adding that it is higher than the market price and that which other European countries pay for natural gas from Gazprom.

Both Russia and Ukraine have filed suits with the Stockholm Court of Arbitration over their gas-pricing dispute, in which Russia announced dramatic increases to Kyiv after the ouster of pro-Moscow President Viktor Yanukovych in late February.

If Kyiv wins its case in Stockholm, it will not have to pay more than the $3.1billion it is expected to pay under the interim agreement by the end of 2014.

If Russia wins the case, however, Kyiv has to pay an additional $2.1 billion.

Ukrainian Prime Minister Arseniy Yatsenyuk said that "under no circumstances" will Kyiv dismiss its case against Russia over the pricing of gas.

Earlier on September 26, Hungarian Prime Minister Viktor Orban said he had stopped sending reverse-flow gas to Ukraine the previous day because he could not risk Hungary's gas deliveries from Russia.

Orban said Budapest "cannot get into a situation in which, due to the Russian-Ukrainian conflict, it cannot access its required supply of energy."

Moscow has warned that Europe is contractually not allowed to re-export gas to Ukraine and could see its supplies cut if it did so.

The EU had earlier criticized Hungary for ending its gas deliveries to Ukraine. Kyiv also expressed its unhappiness with the decision.