PARIS — The main suspect in the bombing last week in the central French city of Lyon has told investigators that he had pledged allegiance to the Islamic State, a French judicial official said on Thursday.

The official, who was not authorized to speak publicly about the case, identified the suspect as Mohamed M., but did not provide any additional details.

The suspect was arrested on Monday at a bus stop in Lyon and is still in custody, where he admitted to investigators that he had carried out the bombing. But his exact motivations — and whether he had direct ties to the Islamic State or to a wider network — remain unclear, the French authorities said.

There has been no claim of responsibility from the Islamic State for the bombing, in which 13 people were lightly wounded by a device packed with screws, metal balls and batteries that exploded outside a bakery in the center of Lyon, France’s third-most populated city.