The European Union has agreed to put Ukraine on a path toward EU membership, acting with uncharacteristic speed and unity to pull the embattled country further away from Russia's influence and bind it more closely to the West.
Meeting at a summit in Brussels, leaders of the EU's 27 nations mustered the required unanimous approval to grant Ukraine candidate status. That sets in motion a membership process that could take years or even decades.
Ukrainian President Volodymyr Zelenskyy tweeted his gratitude and declared: "Ukraine's future is within the EU."
"It's a victory. We have been waiting for 120 days and 30 years," he said on Instagram, referring to the duration of the war and the decades since Ukraine became independent upon the breakup of the Soviet Union.
"And now we will defeat the enemy."
European Commission President Ursula von der Leyen pronounced it a "good day for Europe."
There was no immediate reaction from the Kremlin.
The EU also gave candidate status to the tiny country of Moldova, another former Soviet republic that borders Ukraine.
Ukraine applied for membership less than a week after Moscow invaded on February 24. Thursday's decision was unusually rapid for the EU and its go-slow approach to expansion. But the war and Ukraine's request for fast-track consideration lent urgency to the cause.
To gain EU membership, countries must meet a detailed host of economic and political conditions, including a commitment to the rule of law and other democratic principles. Ukraine will have to curb entrenched government corruption and adopt other reforms.
The European Parliament endorsed Ukraine's bid hours before the summit started, passing a resolution that called on EU governments to "move without delay."
"It will strengthen Ukraine, it will strengthen Europe. It is a decision for freedom and democracy and puts us on the right side of history," European Parliament President Roberta Metsola said ahead of the final decision.
The EU nations have been united in backing Ukraine in its fight against Russia's invasion with money and weapons, adopting unprecedented economic sanctions against the Kremlin.
EU candidate status doesn't provide any immediate security guarantees. Once a country gains membership, however, it is covered under an EU treaty clause that says if a member falls victim to armed aggression, the other EU countries are obligated to assist it by all means in their power.
The main benefits of EU membership, though, are economic, since it gives access to a market of 450 million consumers with free movement of labor, goods, services and capital.
Ukraine has long aspired to join NATO, too, but the military alliance is not about to offer an invitation, in part because of the country's corruption, shortcomings in its defence establishment, and its contested borders.
Before the war, Russian President Vladimir Putin demanded that Ukraine never be allowed to join NATO, which he has condemned for its eastward spread toward Russia's flank. But earlier this month, he did not seem bothered by Ukraine's determination to get closer to the EU, saying it is not a military pact and thus "we have no objections."
In 2013, however, Putin objected to Ukraine's plans to sign an association agreement with the EU and pressured the Ukrainian president at the time to pull out at the last minute. This backfired by setting off mass protests that eventually ousted the president and ushered in leaders more eager than ever to bring Ukraine into the Western fold.
In the years that followed, Russia seized the Crimean Peninsula from Ukraine and fomented a separatist uprising in the country's Donbas region in the east.
The EU's leaders also agreed to recognise a "European perspective" for yet another former Soviet republic, Georgia. European Council President Charles Michel said the EU will be ready to approve its candidate status once "outstanding priorities" are addressed.
Poland's Prime Minister Mateusz Morawiecki, whose country has been a staunch supporter of Ukraine's European aspirations for years, said on Twitter: "This is a great moment for Europe's unity and for the defense of its basic values. The struggle for freedom goes on."
The membership process can be long and tortuous.
Turkey applied for membership in 1987, received candidate status in 1999, and had to wait until 2005 to start talks for actual entry. The whole process is at a standstill because of various disputes between the EU and Turkey.
Similarly, several Balkan countries have been seeking for many years to join the EU.
European officials have said that Ukraine has already adopted about 70 per cent of the EU rules and standards, but they also have pointed to the need for other far-reaching measures.
"Considerable efforts will be needed, especially in the fight against corruption and the establishment of an effective rule of law," Belgian Prime Minister Alexander De Croo said.
"But I am convinced that it is precisely the reconstruction of Ukraine that will provide opportunities to take important steps forward."