Greece couldn't get a debt deal with Europe. So it went to Russia and signed a controversial gas deal instead!

Officials agreed Friday to build a pipeline that would bring Russian gas through Greece and into western Europe, Russian state media reported.

Greece's Prime Minister Alexis Tsipras, who was in St. Petersburg Friday, said, "I'm here because I believe that the role of a country that wants to explore its potential to succeed, [should] have a multi-dimensional policy in its relations with countries."

Russian energy minister Alexander Novak said the gas deal took the relationship between the two countries to "a new level."

Russia and Greece already share deep ties from culture and the Orthodox Church, to commerce. Russian tourists visit Greece in large numbers every year.

But they've been drawing even closer together since Greeks voted left-wing Syriza into power earlier this year.

Talks between Greece and other European governments over how to resolve its debt crisis have grown increasingly acrimonious. A meeting of finance officials Thursday broke up without progress, and time is running out fast.

Many doubt Greece will be able to pay its bills over the next few weeks, and it's refusing to bow to demands for economic reforms from its creditors.

According to a Russian report, the new gas pipeline -- which will bypass Ukraine -- will cost roughly two billion euros ($2.3 billion) and will be completed by 2019. The costs will be covered by Russia, with the understanding that Greece will repay its pipeline debts later.