EU countries must take in Afghans under "immediate threat" after the victory of the Taliban, especially women and girls, the European commissioner for home affairs said on Wednesday.
"We should not wait until people are at our external border. We need to help them before that," Ylva Johansson said before taking part in an emergency videolink meeting of EU interior ministers.
"And it's important that we also help those in immediate threat to be resettled to EU member states."
She and the EU foreign policy chief Josep Borrell updated the ministers on the situation in Afghanistan, where EU countries are among those frantically evacuating citizens and Afghan staff following the Taliban's sudden return to power.
The ministers' virtual meeting had originally been called to discuss ways to respond to another pressing migration issue: that of Belarus encouraging thousands of migrants, especially from Iraq, to cross its borders into Lithuania and other EU states.
But the events unfolding in Afghanistan, which have fuelled European fears of a fresh wave of Afghan asylum-seekers headed to the EU, overshadowed the talks.
Johansson said that EU countries "need to avoid a migratory crisis" from Afghanistan.
Resettlement offers should be extended to Afghans in desperate need -- "people that have been working for fundamental rights for journalists, for example, and others in Afghanistan that now are under threat and really need to be resettled in safety to the European Union."
She added that the "gender dimension" was also important, meaning "we can help women and girls".
But the EU should also help countries neighbouring Afghanistan cope with expected inflows of Afghan migrants, and action should be taken to prevent them taking "dangerous routes that are facilitated by smugglers", she said.
Johansson added that it was "important that we can help these people in Afghanistan when possible to return to their homes".
The commissioner is spearheading a campaign to have EU member states adopt a new migration and asylum pact the European Commission is proposing.
But not all EU countries are on board with that plan, which foresees the burden of hosting migrants being shared out across the 27-nation bloc instead of being concentrated, as now, on countries such as Greece and Italy.
Afghanistan has seen 550,000 internally displaced people since the beginning of this year, on top of 2.9 million counted at the end of last year, the Commission says, using UN figures issued before the Taliban takeover.
Johansson, in a statement, said the EU will "intensify" cooperation with Afghanistan's neighbours Pakistan, Iran and Tajikistan, which are already hosting big numbers of Afghan migrants.
This also applies to Turkey -- the key country outside the EU that served as the main entry point for asylum-seekers until a 2016 deal struck between Brussels and Ankara that stemmed the flow.
Before the Taliban triumph in Afghanistan, several EU countries such as Austria, Belgium, Denmark and Germany had been intent on forcibly repatriating Afghans whose asylum bids had been turned down.
Most have now suspended those plans, but Austria on Wednesday said it would lobby the EU to set up "deportation centres" in countries neighbouring Afghanistan to take in deported Afghans.
French President Emmanuel Macron has also pledged a tough stance against illegal migration, though he has emphasised that France would "protect those who are most under threat in Afghanistan".