The warning comes after Britain’s defence ministry said that combat units from both sides are “experiencing variable morale” at this stage of the war.
Jens Stoltenberg, secretary-general of Nato, told Germany’s Bild am Sonntag newspaper: “We must prepare for the fact that it could take years. We must not let up in supporting Ukraine.
“Even if the costs are high, not only for military support, also because of rising energy and food prices.”
He added supplying state-of-the-art weaponry to Ukrainian troops would increace the chance of freeing the Donbas region from Russian control.
Boris Johnson has also said it is important for Britain to provide support for the long haul, warning of a risk of “Ukraine fatigue” as the war continues.
“I’m afraid we need to steel ourselves for a long war,” the prime minister wrote in the Sunday Times.
“Time is the vital factor. Everything will depend on whether Ukraine can strengthen its ability to defend its soil faster than Russia can renew its capacity to attack.”
Mr Johnson, who visited Kyiv on Friday with an offer of training for Ukrainian forces, also said supplies of weapons, equipment, ammunition and training to Ukraine needed to reach the country “more rapidly than the invader”.
Ukraine’s president Volodymyr Zelensky this week visited forces in the southern Mykolaiv region, about 550 km (340 miles) south of Kyiv.
“Their mood is assured: they all do doubt our victory,” he said in his daily video message. “We will not give the south to anyone, and all that is ours we will take back.”
In Mykolaiv and Odesa regions, Mr Zelensky said he had heard reports on destruction from Russian strikes.
“The losses are significant. Many houses have been destroyed; civilian logistics have been disrupted,” he said.
Mr Zelensky said on Sunday he expects Russia to intensify its attacks on his country while Kyiv awaits a European Union decision this week on granting Ukraine the status of a candidate country.
“Obviously, this week we should expect from Russia an intensification of its hostile activities,” the Ukrainian president said in his nightly video address.
“And not only against Ukraine, but also against other European countries. We are preparing. We are ready.”
A key target in Russia’s attempt to gain full control of Luhansk region – one of the two provinces making up the Donbas – is the industrial city of Sievierodonetsk, where fighting continue to rage.
“All Russian claims that they control the town are a lie. They control the main part of the town, but not the whole town,” Luhansk Governor Serhiy Gaidai told Ukrainian television, adding that fighting made evacuations from the city impossible.
Russia’s defence ministry said it had taken control of Metyolkine, just southeast of Sievierodonetsk, with Russian state news agency TASS reporting that many Ukrainian fighters had surrendered there. Ukraine’s military said Russia had “partial success” in the area.
Analysts at the Institute for the Study of War, a Washington-based think tank, wrote in a note that “Russian forces will likely be able to seize Sievierodonetsk in the coming weeks, but at the cost of concentrating most of their available forces in this small area”.