He is alleged to have shouted "Allahu Akbar" - Arabic for "God is great" - during the attack in the the Minimes district of Toulouse, according to news website France Info.
The man was detained by police Wednesday after he allegedly punched and kicked several people in the street, as well as the officers who came to arrest him.
He burst into tears after he was wrestled to the ground, handcuffed and placed on to a stretcher for transport to a hospital.
One man told local media: "We were chatting and he jumped on us". First, he attacked my son and then my daughter.
The attacker was not carrying any weapons but two victims were taken to hospital with minor injuries.
Three offficers were injured while attempting to detain the man, who is in custody, at around 4.45pm local time (3.45pm BST).
Police said the suspected attacker had been released from a psychiatric facility in April.