The EU is keen to avoid a repeat of the 2015 migration crisis when more than one million migrants arrived at the bloc's external borders.
The European Union has formally agreed to rely on countries neighbouring Afghanistan to manage and host a potential wave of refugees fleeing Taliban rule.
Ministers from the 27 EU countries, in consultation with representatives from the European Commission, took the decision after gathering in Brussels for an in-person meeting of the EU Council.
"The best way to prevent migration crisis is to prevent a humanitarian crisis," said Ylva Johansson, European Commissioner for home affairs.
The final statement agreed by ministers makes clear the bloc's end goal: avoid a repeat of the 2015 migration crisis when more than 1 million migrants arrived at the bloc's external borders.
Back then, Afghans were the second-largest group of refugees, after Syrians. The episode polarised domestic politics and still reverberates across the continent.
This time, the bloc intends to act with greater speed and resolution. It is drafting plans to strengthen cooperation with non-EU countries to prevent migrants from reaching the continent.
The EU has already earmarked €200 million in humanitarian aid to deal with the Afghan crisis.
The United Nations estimates that more than 3.5 million people are currently displaced in Afghanistan, although "no big movement of Afghans" leaving the country has been registered so far, according to Johansson.
Since the European Union has failed to agree on an EU-wide migration policy, the bloc has to use Council meetings to design ad-hoc strategies for each crisis.
The call to support third countries immediately evoked the 2016 EU-Turkey deal, which is credited with a significant reduction of arrivals. But Commissioner Johansson rejected any comparison, saying it is "not a good idea to copy-paste EU-Turkey deal" in this context and the EU should instead focus on "tailor-made" solutions.
Practical and financial details for this cooperation are expected to be hashed out over the next weeks.
A Financial Times report suggests the EU could approve a €600-million package for countries like Pakistan, and possibly to Uzbekistan and Tajikistan, to help them receive and host refugees.
It is unclear if any of these plans will include Iran, a country placed right between Afghanistan and Turkey. Iran is currently subject to an extensive series of EU sanctions.
Security featured prominently during Tuesday's discussion, which Slovenian minister Aleš Hojs characterised as "very dynamic".
Countries vowed to "respond to attempts to instrumentalise illegal migration for political purposes and other hybrid threats", a veiled reference to the ongoing situation on the Belarus-Lithuania border. The EU has accused Belarusian President Lukashenko of encouraging migration into the bloc.
Ministers also called on three EU agencies – Frontex, Europol and the European Asylum Support Office (EASO) – to guarantee the protection of external borders and urged governments to combat "the narratives used by smugglers" and refrain from "incentives to illegal migration".
The term "illegal migration", used fives times throughout the text, is disputed due to its criminal connotations. The Commission prefers to use "irregular migration" in its official communications.
On the question of resettlement, which proved to be extremely divisive in 2015, interior ministers leave the door open to "resettlement on a voluntary basis" for vulnerable people.
However, this call for solidarity constitutes a brief note in the overall text, whose main focus is the prevention of uncontrolled, large-scale migration.
At the end of the Council meeting, Johansson said she will convene a forum in September to discuss resettlement with member states and provide solutions to vulnerable Afghans, like women, children, human rights activists, journalists and lawyers.
Johansson avoided giving a concrete number of how many Afghans need to be resettled but underlined the discussion must be held at a global level with the United Nations and international allies.
Asked about possible recognition of the Taliban government, Johansson said the "EU is quite far" from taking the step and the Taliban must be judged on what they do, not what they promise to.
The EU has frozen a multi-year €1-billion programme in development assistance for Afghanistan until there's greater clarity surrounding the new government.
Tuesday's extraordinary meeting in Brussels took place mere hours after the United States completed its evacuation operations, putting an end to America's longest war and cementing the Taliban's victory.
European countries wrapped up their evacuation efforts in the days leading up to the withdrawal of US troops.