PARIS — The man accused of stabbing three soldiers guarding a Jewish community center in southern France this week had been questioned by counterterrorism officers and released in the days before the attack, a senior police official said on Wednesday.

The man, Moussa Coulibaly, was arrested on Tuesday after, the police said, he lunged at the throat of a soldier near the Jewish center in Nice and wounded him and two other soldiers who intervened. The attack raised alarm in a country still reeling from the terrorist attacks last month in and near Paris that left 17 people dead.

Christophe Crépin, a senior police official, said Mr. Coulibaly, who was known to French counterterrorism services and had a criminal record, had been questioned by the intelligence services in France after he flew to Turkey on Jan. 28. Turkey is frequently used as a gateway by Europeans seeking to join extremist groups in Syria. But Mr. Crépin said no formal investigation was opened and Mr. Coulibaly was released, as there was insufficient evidence that he posed a threat.

“We can’t arrest and detain every person who comes back from Turkey,” he said. “We must obey the rule of law, and uphold civil liberties, and there was nothing to suggest Mr. Coulibaly would commit such an attack.”