Nicolas Sarkozy, the interior minister and conservative hopeful for the 2007 presidential elections, has made strict anti-illegal immigration policies a key plank of his programme.
But many politicians and human rights activists have rallied behind the cause of the immigrants who are occupying a sports hall at Cachan, near Paris.
Pierre Henry, director of the France Terre d'Asile humanitarian organisation and a mediator in the standoff, said: "An agreement has been signed at 3:30 this morning [0130 GMT] about the housing and protection of 370 people."
Sarkozy said: "The evacuation is taking place. It seems that responsibility and calm have prevailed and I am profoundly delighted."
The evacuation was expected to be completed on Monday.
More than 200 squatters with residence permits will be rehoused. Around 150 illegal immigrants will be dealt with on a case by case basis prior to any deportation decisions.
Richard Serero, secretary-general of the League against Racism and Antisemitism (Licra), said: "We hope to have found a solution that is as humane as possible for these people who were in total distress."
The immigrants moved into the hall after a giant squat in a disused university dormitory was evacuated by police on August 17.
Most of the immigrants are from sub-Saharan Africa.
Patrick Gaubert, president of Licra and a European deputy for the UMP government party headed by Sarkozy, said: "There are some 70 to 80 people who will move today to two or three sites."
More space to house the squatters was being sought in the Paris region, he said.