"We want readmission agreements. Although we are aware of the existing problems, we cannot only focus on repressive measures," EU Justice Commissioner Franco Frattini said.
"We have to fight together with the police, with the secret services, of the countries concerned," he said in an interview.
He was speaking ahead of July 10-11 talks between EU and African foreign and interior ministers on migration in Morocco, the first such high-level discussions on the issue.
The wealthy bloc is negotiating an agreement with Morocco for the readmission of migrants, and wants to do the same with other African countries.
A commission aide said negotiations with Morocco were well advanced but were caught up the EU demand that Morocco take back not only its own nationals but those from other countries who transited through its territory.
The aide said Algeria, which is not taking part in the Rabat conference, was so far refusing to talk about readmission.
The death of illegal African migrants storming the razor-wire borders of the Spanish enclaves of Ceuta and Melilla last year spurred European leaders to scramble for ways to cooperate better with African states to stop the migrant flows.
Human rights group accuse the EU of wanting to shift the burden of stopping migrants to the north African countries which they transit without giving those states the means to properly care for them.
But Frattini said the EU wanted "to help states of transit to face this very difficult situation that is the consequence of a concentration of people."
Some 20,000 people are gathered in Mauritania before trying to make the crossing to Spain's Canary Islands, Frattini said. Libya, Morocco and Algeria also faced the same problem.
"We see people dying in the desert. Is it possible to think about giving them drinkable water? The answer is 'yes'. Is it possible to provide for them better infrastructures, temporary infrastructures? I think yes."
But Frattini said it was up the countries concerned to take the initiative, with EU help, and stressed the EU was not going to build detention centers in Africa for migrants -- one controversial idea that has been floated.
He said the EU could provide help in sending illegal migrants back to their home country.
The EU is preparing its first sea patrol mission to stop migrants leaving the coast of west Africa to the Canaries, and wants to do more in the future.
Frattini insisted the cooperation would not only be about repressive measures, but also about boosting African economies and opening more channels for legal migration to the EU.
"We have to offer something in return to origin countries."
The ministerial meeting of more than 60 African and EU countries in Rabat is set to end with a pledge by EU and African ministers to work together to fight illegal migration, develop African economies, and facilitate legal migration.
• Malta experiences illegal immigrant crush, requests EU help
• African migrants attempt entry into the EU via Mediterranean
• European Commission plans spyplanes to patrol EU borders
• Would be migrants flock to Europe by sea
• EU considers immigration agreement