French Interior Minister Gérard Collomb announced the dismissal of prefect Henri-Michel Comet and his deputy, Xavier Inglebert, following a report that criticised "errors of judgement" and "serious faults" in the handling of foreigners whose papers are not in order.
It was commissioned after 29-year-old Tunisian Ahmed Hanachi killed two cousins, 20-year-old Mauranne Harel and 21-year-old Laura Paumier, in front of Marseille's main railway station on 1 October.
Police shot Hanachi dead shortly after the attack.
The Islamic State armed group claimed responsibility for the attack, although investigators have so far found no evidence that Hanachi was in contact with them.
Attacker arrested but freed
Hanachi had been arrested over a theft in a shopping precinct in the city of Lyon two days before but released, despite not having the documents needed to live in France.
Police contacted the local centre for holding undocumented foreigners but were told there were no places available.
When a place was freed shortly afterwards, the official at the centre did not feel he had the authority to disturb the sub-prefect who could have signed a deporation order because he was at an official ceremony.
Hanachi was known to police for drug and alcohol problems but was not on France's terror watchlist.
Shortage of places criticised
While not blaming any individuals for the "malfunction", the report criticised the centre's poor organisation, as well as the shortage of places and personnel.
It also criticised police for not seeking a place at another centre.
The lower house of the French parliament has just passed a tough new anti-terror law to replace the state of emergency declared after the November 2015 Paris attacks and Collomb announced a number of changes to the running of such centres, including adding 200 extra places that would be reserved as a priority for undocumented foreigners who represent a threat to public order.
Attackers' brothers detained
Police are investigating two of Hanachi's brothers, Anis and Anouar.
Anis, who is said to have fought with jihadi groups in Iraq and Syria and was on the run after being arrested in Tunisia in 2014, has been arrested in northern Italy on the strength of a French international arrest warrant and is expected to be extradited to France.
Swiss police announced the arrest of a Tunisian couple on Tuesday and French security sources confirmed that then man is Anouar.
Tunisian police detained another of Hanachi's brothers, Moez, and his sister, Amina, on Friday but have released them after concluding they have "nothing to do" with the attack.