Ukraine applied for EU membership less than a week after Moscow invaded on February 24.
The decision by the leaders of the 27-nation bloc to grant Ukraine candidate status on Thursday was uncharacteristically rapid for the EU - but the war and Ukraine's request for fast-track consideration lent urgency to its cause.
The EU also granted candidate status to Moldova, which borders Ukraine.
Gaining membership could take years or even decades.
Countries must meet a detailed host of economic and political conditions, including a commitment to the rule of law and other democratic principles.
European officials have said that Ukraine has already adopted about 70% of the EU rules and standards, but they also have pointed to corruption and the need for deep political and economic reforms in the country.
President Volodymyr Zelenskyy tweeted his gratitude and declared: “Ukraine’s future is within the EU.”
Ukraine has long aspired to join NATO, too, but the military alliance is not about to offer an invitation, in part because of governmental corruption, shortcomings in the country's 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.”What happens next
Once an applicant country meets the conditions for membership, it must implement EU rules and regulations in all areas.
Countries then need to meet the ‘Copenhagen criteria’, which includes a functioning market economy, a stable democracy and the rule of law - and acceptance of all EU legislation, including of the euro.
The Council must then agree upon a negotiating mandate.
Negotiations are then formally opened on a subject-by-subject basis.
Finally when the candidate country has met all accession criteria and is ready to become part of the EU, they can be accepted into the Union.