Eight days after the police shot dead the self-confessed killer of four Jews and three French paratroopers in Toulouse, the French police on Friday detained 17 people described as Islamic militants in that city and other parts of France.

The French president, Nicolas Sarkozy, said that the detentions were not directly related to the killings in Toulouse, where the gunman, Mohammed Merah, claimed membership in Al Qaeda and was killed by the police as he resisted arrest.

The raids appeared to have two purposes. The first was to “kick the ant pile,” as the French say — a preventive act to detain a variety of people and interrogate them, to try to ensure that there are no further plots under way and no copycat killings. The president said some Kalashnikov assault rifles had been seized.

The second seemed to be to reinforce Mr. Sarkozy’s image as tough on crime and on Islamic radicalism, an image that is expected to aid him in the presidential election less than a month away.

On Thursday, Mr. Sarkozy continued his tough talk, saying that at least four imams whom he judged to be more radical than others would not be allowed into France to attend a religious conference. He also said that raids “are going to continue” and will result in the deportation of some people from France.

And he compared the shock of Toulouse to Sept. 11, 2001, in the United States, a comment that was quickly criticized as excessive by his rivals for the presidency.

“What must be understood is that the trauma” of Mr. Merah’s killings “is profound for our country, a little — I don’t want to compare the horrors — a little like the trauma that followed in the United States and in New York after the Sept. 11, 2001, attacks,” Mr. Sarkozy told Europe 1 radio.

His main rival, the Socialist candidate François Hollande, runs ahead of Mr. Sarkozy in polls on most other key issues, like the economy and unemployment. Mr. Hollande has criticized Mr. Sarkozy for using overblown language, but has been reluctant to say anything that appears to be critical of the French police or intelligence services in the wake of the Toulouse killings.

The authorities said that 19 people were arrested in the early morning raids Friday in the Paris region and in southern and western cities, including Toulouse and Nantes. Two people were held briefly and released, while 17 others remained in custody. They will be questioned under antiterrorism rules and many of them are likely to be quietly released.

Nantes had already figured in police investigations after the Interior Ministry in January closed down a small militant group, Forsane Alizza, accused of extremist views. Before the authorities shut its Web site, the group said it sought to recruit “soldiers,” though for what purpose remained unclear. The leader of the group, Mohammed Achamlane, who was detained on Friday, has denied that the group is seeking jihadist recruits or that it had any links to Mr. Merah.

Mr. Merah told the police he had killed three French soldiers, all Muslim, because they were fighting Muslims in Afghanistan, before he attacked a Jewish school in Toulouse last week, killing three children and a rabbi.

Investigating judges have filed preliminary murder and terrorism charges against Mr. Merah’s older brother, saying that the killer acted with his guidance. The brother, Abdelkader Merah, 29, was described by the police as an Islamic radical who reportedly had ties to at least one jihadist network. The brother denies involvement in the fatal shootings, his lawyer said.

The police say it is likely that a third man was involved.

Mr. Merah, a 23-year-old French citizen, was buried Thursday after disputes over where he should be interred. The authorities in Algeria, where his father lives, refused to accept the body on security grounds. The municipal authorities in Toulouse were also reluctant to permit the burial until Mr. Sarkozy stepped in. Around 30 people attended the burial. His mother did not attend, and he was buried in an unmarked grave to prevent desecration.