A migrant carries her children after being helped ashore from a RNLI (Royal National Lifeboat Institution) lifeboat at a beach in Dungeness, on the south-east coast of England, on November 24, 2021, after being rescued while crossing the English Channel. AFP
Germany will accept the bulk of the new arrivals, with 25,000, with the Netherlands accepting 3,159, Spain and France 2,500, and other countries lower numbers, according to a document seen by AFP.
"And I think this is an impressive act of solidarity," Johansson said, arguing that allowing more Afghans to migrate in a controlled way would help prevent "irregular arrivals".
The UN High Commissioner for Refugees had previously urged the bloc to accept 42,500 Afghans over five years, but some of the 27 member countries had resisted.
There are an estimated 85,000 Afghans who have fled their homeland into countries nearer the EU, and the Taliban's seizure of Kabul coupled with a fierce drought could trigger new flows.
During the aftermath of the chaotic US military withdrawal and the return of the Taliban regime, in August, 24 EU states have already taken in 28,000 evacuees.
But UNHCR chief Filippo Grandi has warned that 85,000 Afghans that are living in vulnerable situations outside the bloc need resettlement, and has urged Europe to take half.
Johannson had previously described this goal as "doable" but she still had to persuade member state governments, only confirming the figure after the meeting on Thursday.
The 40,000 Afghans are part of a larger 60,000 package of resettlements and humanitarian admissions pledged by member states, according to the document seen by AFP.
In the larger global envelope, France and Sweden make bigger pledges of 5,000 and 4,200 resettlements, but these will not necessarily be Afghans. Belgium promised places for 425 Afghans and 1,250 others.
EU officials were not immediately able to give a time scale for the new arrivals.