A former teacher who held 21 students and two adults hostage at a school in western France for several hours has surrendered to police.
The students held hostage were aged 16 to 18
The captives, mostly students aged 16 to 18, were unharmed and the handover passed off calmly, officials said.
The 33-year-old man, carrying a handgun, was said to be protesting about his employment problems.
He had lost his job as a supply teacher at the Colbert de Torcy secondary school two years ago.
The siege began early in the afternoon on Thursday.
The students, and two adults described as playground workers, were barricaded inside a classroom on an upper floor of the school.
Police surrounded the building quickly and French special forces were sent in to conduct negotiations.
Jean Luc Prigent, head of security for the region, told French Info radio it was "a happy end" to the event.
He said the special forces were able to reach "a complete release of the group without violence".
French special forces were called to the school
The man's demands during the crisis to speak to the media and a former education minister from the region - as well as accounts from school workers who knew him - suggested he was depressed about not finding work for a prolonged period of time.
Top local official Stephane Bouillon said the man had respect for the children and wanted "his distress to be dealt with".
A receptionist at the school told the BBC News website: "He looked normal when he walked in... We let him in because we knew who he was."
She said he was not known to be violent. "He had a sense of humour," said the receptionist, Bernadette Mercier. She added: "He was very depressed when he left two years ago."
A crisis centre for parents and students has been set up.