"The price of freedom is worth paying," Boris Johnson has said when asked about the cost of helping defend Ukraine.
Speaking from a G7 summit, he argued that letting Russia "get away with" invading Ukraine would have "chilling" consequences and lead to instability.
Likening the conflict to defeating Nazi Germany in World War Two, the PM said that war had been "very expensive" but delivered "long term stability".
It comes as the Ukrainian president calls for more military support.
Over a video link, Volodymyr Zelensky told the leaders of the world's advanced democracies at the summit that his country needed more anti-aircraft defence systems to help repel Russia's invasion.
He also said they needed to impose more sanctions to keep the pressure on Russian leader Vladimir Putin.
G7 leaders, meeting in Germany, are expected to offer more military support as well as further sanctions against Russia, with some planning to ban Russian gold imports.
Speaking to the BBC's political editor Chris Mason from the summit, Mr Johnson said there was "no alternative" to supporting Ukraine regain its sovereignty.
He argued that the consequences of letting Mr Putin "get away with the violent acquisition of huge chunks of another country" would be "absolutely chilling".
"In terms of the economic effects, that would mean long-term instability and anxiety across the world," he said.
Asked if there was any limit on the amount of money or support the UK would offer Ukraine, Mr Johnson replied: "The price of freedom is worth paying."
He said defeating dictators in World War Two "took a long time" and was "very expensive" but brought "decades and decades of stability" and delivered "long-term prosperity".
The UK government has said it is spending £1.3bn ($1.6bn) on military support for Ukraine.
And at the summit, the UK pledged £10m to repair damaged Ukrainian rail infrastructure, to create an overland route to get grain out of the country.
The ongoing conflict in Ukraine has pushed up oil and gas prices leading to higher energy bills, while a squeeze on Ukrainian global grain production has pushed up the cost of food.
Addressing the repercussions on the UK at a time of rising costs of living, Mr Johnson said: "Just to reassure people at home, I think the economic impacts on the UK will start to abate. Cost pressures will start to come down."
In an interview over the weekend, Mr Johnson was asked on Radio 4's Today programme if there was any matter of principle he would consider resigning over, and he said if he had to abandon Ukraine because it became too difficult or the costs were too great, he would quit.
"If it was put to me that we had to abandon the Ukrainian cause, because it was simply getting too difficult and that the cost of supporting that people in their heroic fight for freedom was too great in terms of inflation, in terms of economic damage," he said.
"I think I would, accept that I'd lost a very important argument."
Mr Johnson is currently facing pressure from some of his own MPs after his party lost two by-elections last week - including the previously safe seat of Tiverton and Honiton in Devon.
Following the defeats, the Conservative Party chair, Oliver Dowden resigned telling the prime minister it could "not be business as usual".
Earlier this month, Mr Johnson survived a confidence vote among his own MPs - although 148 voted against him.
Under party rules, Mr Johnson cannot face another leadership challenge for another year. However some Conservative rebels have suggested the party rules could be changed to enable another contest.
Mr Johnson could also be pressured into stepping down if several senior ministers resigned.
But speaking from the G7 summit, he insisted he had the authority to continue governing and had a mandate from the public as well as his own MPs to stay in office.
He said he was focused on his job adding: "It is a huge, huge privilege to do it and nobody abandons a privilege like that."
Conservative MP - and critic of the prime minister - David Davis has said he opposed forcing another confidence vote in the prime minister.
"He's got to use the year he has to prove to us that actually, he can deliver on the promises we gave at the 2019 election - which was low tax," he said.
"I have people, working class voters in council estates, saying you're not behaving like a Conservative government... that's a terrible thing to have to face down."