French police have freed the children held hostage by a teenager armed with a sword.

The teenager had burst into the kindergarten in Besancon, France, and initially held hostage 20 pupils and a teacher. He later let most of the children go but kept five, aged between four and six.

After speaking to the armed hostage-taker on the phone, police managed to enter the building around midday and released the children unharmed.

French Education Minister Luc Chatel said that police overpowered the youth after he was separated from the children as they prepared to eat.

Teenage swordsman holds schoolchildren hostage

“He is a clearly depressive individual who never had any other demand but to put an end to his own life,” said Chatel said.

According to the teacher who was taken hostage along with the children, the teenager repeatedly talked about committing suicide and never actually seemed threatening to others.

The unnamed teenager has now been detained by police.

It emerged that the teen had stopped taking the medication that he took for depression.

The children who were held hostage as well as their families will now receive counselling.