Boris Johnson has said leaders must be honest about rising costs due to the Ukraine war, but said the price of Russia succeeding was “far higher”.
He said world leaders understand they must remain united with Kyiv despite fears of war fatigue.
Allies were “making the sacrifice” over rising food and energy costs because “the price of freedom is worth paying,” he said.
The PM is at the G7 summit as he faces pressure over his leadership at home.
After leaving Germany, Mr Johnson will head to Madrid for a Nato summit before flying home on Thursday – his first return to the UK since the Conservatives lost two by-elections.
He has rejected calls to resign, saying he is focused on the cost of living, the economy and “standing up to violence and aggression” in Ukraine.
Speaking in the Bavarian Alps where the G7 summit is being held, Mr Johnson said leaders would be discussing how to keep the coalition of support together “at a time when realistically there is going to be fatigue among populations and politicians”.
He said Nato and the G7 continue to be “solid” in their stand against the invasion by Russian President Vladimir Putin, but to protect that unity they must have “really, really honest discussions” about the pressures each nation is under.
The prime minister gave the example of Germany, which is taking emergency measures after Russia cut gas supplies, saying: “They’re making the effort, they’re making the sacrifice. That’s because they see the price of freedom is worth paying.”
He said the G7 and Nato were defending the principle that a free, sovereign country should not be “violently invaded and have its boundaries changed by force”.
“The price of backing down, of allowing President Putin to hack off parts of Ukraine, to continue with his programme of conquest – that price will be far, far higher and everyone here understands that,” Mr Johnson said.
In an interview with CNN on Sunday Mr Johnson was asked about surviving a confidence vote and his party’s by-election defeats and insisted the scrutiny he had faced had been a good thing.
The prime minister questioned whether Russia’s invasion of Ukraine would have happened if Mr Putin had faced similar dissent and had “the 1922 committee on his case”.
Ukrainian President Volodymyr Zelensky is due to address the G7 countries – the UK, US, Canada, Japan, France, Germany and Italy – on Monday.
Ukraine is urgently asking for more financial help due to fears it could run out of funding by the autumn without further support.
Mr Johnson is due to pledge £429m to Ukraine in guarantees for World Bank lending, as its fight against the Russian invasion drags on.
The loan guarantees provided by the UK will take its package of economic and humanitarian support for Ukraine to £1.5bn.
The British government feels Germany and in particular France are feeling the domestic political pressure of some of the consequences of the Ukraine war – not least spiralling prices.
After Boris Johnson’s meeting with President Macron, Downing Street told us: “The prime minister stressed any attempt to settle the conflict now will only cause enduring instability and give Putin licence to manipulate both sovereign countries and international markets in perpetuity.”
Publicly, No 10 insists President Macron has done “huge amounts” to support Ukraine, but privately there is concern Paris is losing appetite for the long-term slog of the war, and its costs.
Those around the prime minister talk about the need for a “gear change” on sanctions, and they believe the new ones on Russian gold contribute to this, and a “game changer” on military support, which will be talked about more at the Nato summit in Madrid.
Getting there, this week and beyond, will require persuasion and patience. And it comes at a cost.
The prime minister told CNN he thought Brexit had allowed the UK to better assist Ukraine in defending itself against Russia.
“I don’t think that we would have been out in front as the first European country to arm the Ukrainians,” he said.
At the summit on Sunday, Mr Johnson had talks with French President Emmanuel Macron, where the prime minister was said to have stressed that any attempt to settle the conflict now would only give Mr Putin “licence to manipulate sovereign countries”.
He also had a meeting with Canada’s Justin Trudeau, where Mr Johnson said Ukraine was “on a knife-edge” and needed defensive capabilities, training and intelligence to tip the balance in its favour.
Ahead of the summit, Mr Johnson warned that Ukrainians should not be encouraged to “settle for a bad peace” where they were “invited to give up chunks of their territory in return for a ceasefire”.
He said: “Ukraine can win and it will win. But they need our backing to do so. Now is not the time to give up on Ukraine.”
Boris Johnson will also urge Western allies to increase sanctions against Russian President Vladimir Putin and his allies.
Mr Johnson said the UK, Canada, the US and Japan were banning imports of Russian gold, saying the move will “directly hit Russian oligarchs and strike at the heart of Putin’s war machine”.
The UK government says gold is a major Russian export, worth £12.6bn to its economy in 2021 and increasingly used by the country’s oligarchs to try to avoid the impact of sanctions.
At the Nato summit, the prime minister will also push for increased defence spending across the alliance and support Sweden and Finland’s bids to join the organisation.
Asked if he thought there was going to be a global recession, the prime minister said the world was facing “a lot of headwinds” due to rising prices linked to Russia’s invasion of Ukraine.
He said that it was pointless to focus “on how bad things might get” and that he believed things would get eventually better and inflation would slow.