KYIV - Ukraine suffered its sharpest economic decline in over 30 years in 2022 because of the war with Russia, but said foreign aid and the "unbreakable spirit" of its people helped prevent an even worse scenario.

Preliminary economy ministry data on Thursday showed a 30.4% drop in gross domestic product last year and economic analysts said risks and uncertainty remain high, especially if Russia continues to attack critical infrastructure in Ukraine.

Economy Minister Yulia Svyrydenko described the decline in GDP as the biggest in any year since Ukraine won independence from the Soviet Union in 1991, but said the fall was smaller than expected.

"In 2022, the Ukrainian economy suffered its largest losses and damages in the entire history of independence, inflicted on it by the Russian Federation," Svyrydenko, who is also first deputy prime minister, said in a statement.

"The successes of Ukraine's defence forces on the front lines, the coordinated work of the government and businesses, the unbreakable spirit of the population and the speed of rebuilding damaged critical infrastructure units, and also systemic financial support from international donors have allowed us to keep up the economic front and continue our movement towards victory."

The war has caused widespread death and destruction, uprooted millions of Ukrainians, disrupted agriculture, limited access to the Black Sea ports that are vital for grain and metals exports, and driven up defence spending.

Ukraine's economy is export-led, but exports have slumped since Russia's Feb. 24 invasion. The economy ministry said this week that exports had fallen 35% compared with 2021, and physical volumes fell by 38.4% this year.

Ukraine is a major global grain producer and exporter. Grain exports have fallen sharply since the invasion, with some seaports blocked by Russia, but again accounted for the bulk of the country's exports in 2022.

DELIVERING THE 'IMPOSSIBLE'

Prime Minister Denys Shmyhal said in December that the economy could shrink by up to 50% in 2022 if Russia kept attacking critical infrastructure.

Ukraine's ICU investment house said the country's economy had delivered the impossible.

"Similar to the Ukrainian army on the battlefield, the Ukrainian economy defied the worst expectations of collapse and has managed to rapidly adjust to new realities," it said in a research note.

Ukraine's economic decline slowed in the latter months of 2022 after Russian retreats in some southern areas of Ukraine including the Kherson region.

GDP fell by 34% in December after a 37% fall in November, according to the economy ministry's preliminary data.

Foreign aid is set to remain of critical importance to Ukraine's financial stability and economy. Government officials have said Ukraine received about $31 billion in foreign grants and loans in 2022.

The country's budget deficit in 2023 is planned at $38 billion, and the government plans to cover it with foreign aid.

"International partners are ready to support us not only with arms but with money. It is critically important to maintain macro-financial stability," Olena Bilan, chief economist for Dragon Capital investment bank, said on her Facebook page.

Analysts said the risks for 2023 include Russian missile attacks on energy facilities and other infrastructure that since mid-October have caused major power outages and shortages.

"We do not expect a notable economic recovery in 2023, because of weak internal demand and considerable limits in export logistics," ICU said.

Dragon Capital investment bank expects Ukraine's economy to fall by 5 percent this year. Ukraine's GDP grew by 3.4% in 2021.

(Reporting by Olena Harmash, Editing by Timothy Heritage)