Jean-Pierre Raffarin warned, however, that in French state schools "ostentatious attitudes and the proselytism symbolised by some veils must be totally forbidden".
During a visit to a Paris mosque on Friday, he said: "I would hope that a middle ground could be found and it's only if all else fails that a law would then become a last resort."
But stubborn attempts to "display a difference, sometimes in a provocative way, must and will be be contained," he said.
The wearing of the hijab by girls in schools in France and other European countries has become increasingly contentious.
France, whose 60 million population counts five million Muslims, is struggling to balance the principle of secularism with freedom of religion.
Raffarin has repeatedly expressed his wish to see the problem resolved without legislation, but has said that step would be taken if necessary.