Gunmen fired on a police car in Marseille just hours before a visit by Prime Minister Manuel Valls to hail a drop in crime in France's second city.
Residents of the La Castellane neighbourhood on the northside of the city, home to some 7,000, were told to stay indoors following the drug-related incident.
A creche was evacuated as troops from the GIPN special forces unit were sent into the sealed-off estate, a police source said.
"There were shots fired in the direction of a police vehicle coming from hooded individuals armed with Kalashnikovs," said local police chief Pierre-Marie Bourniquel.
Mr Bourniquel later confirmed it was his vehicle that had been targeted.
He had gone to the scene after residents called to report they had seen armed men in the area. Bullets were embedded in a bank above his car, he said.
Police seized seven Kalashnikovs and around 20kg of drugs, according to Interior Minister Bernard Cazeneuve, who was accompanying Mr Valls.
Fingerprints and DNA traces were also found which could help lead to arrests, he added.

Caroline Pozmentier, deputy mayor of Marseille, said the authorities were "99.9% sure" the incident was related to drugs and score-settling, adding that she did not see a link with Mr Valls' visit.
The prime minister said in a speech at the Marseille police headquarters that "the simple fact of wearing a uniform" now exposed officers to violence.
France has been on high alert following Islamist attacks in Paris last month that killed 17 people. Last week, two soldiers protecting a Jewish organisation and radio station were wounded in a knife attack in the city of Nice.