Africans have risked their lives to reach the Canary Islands
EU ministers have agreed in principle to a French plan aimed at reforming immigration rules across the union.
At informal talks in Cannes, ministers from all 27 states signed a draft pact agreeing common rules on the treatment of migrants and asylum requests.
French diplomats hope to get the new rules adopted officially in October.
The ministers agreed to the plans after France dropped a controversial clause calling for migrants to be obliged to learn the host language and culture.
But the pact keeps a pledge to avoid mass amnesties for illegal migrants.
"The interior ministers gave their unanimous accord on the principles, the objectives, the presentation and the structure of the pact," said French Immigration Minister Brice Hortefeux.
He said he hoped the pact would be approved at a summit of EU leaders in mid-October.
France, which began its six-month term as chair of the EU presidency on 1 July, has voiced opposition to mass "regularisations" of illegal migrants, such as Spain's mass amnesty for about 700,000 illegal migrants in 2005.
But Spain's Interior Minister Alfredo Perez Rubalcaba said he was "satisfied" with the French draft pact, adding: "I think it's very important for us to have a common immigration policy."
There are an estimated eight million illegal migrants in the EU.
The pact aims to make it easier for legal migrants to fill job vacancies in Europe and integrate. With its ageing population, Europe has a continuing need for migrant labour in many sectors.
The French news agency AFP says the pact allows for migrant "regularisations" on a case-by-case basis, in accordance with national laws.
It also calls for repatriation agreements with countries where necessary and for the European Commission to draft an EU plan for common EU-wide asylum procedures to be in place in 2012, AFP reports.
"We're talking about targeted and coordinated immigration - in other words, which takes account of countries' needs and their ability to host migrants, based on dialogue with the countries of origin," Mr Hortefeux said.
Spain and Malta have been struggling to cope with boatloads of African would-be immigrants in recent years.
Meanwhile, the European Commission and human rights groups have expressed concern about the Italian government's plan to fingerprint tens of thousands of Roma (Gypsies) living in makeshift camps across Italy.
The EU has already adopted new rules for detaining and expelling illegal immigrants. The "returns directive", due to take effect in 2010, allows states to hold illegal immigrants for six months, extendable by another 12 months in certain cases.
Earlier this month South American heads of state jointly condemned the returns directive. Hundreds of thousands of Latin Americans live and work in Europe, many of them illegally.
In 2005, Spain said illegal immigrants could claim work and residency papers if they could present a six-month work contract and evidence that they had lived in the country since August 2004.
Ecuadoreans were the largest group to apply under the amnesty, followed by Romanians and Moroccans.