A former teacher armed with a handgun and reportedly suffering from depression held 23 hostages — most students — for several hours Thursday in a high school classroom before surrendering calmly, police said.

The 33-year-old man, who was unemployed and looking for work, turned himself in after hours of negotiations as he held the hostages captive throughout the afternoon and early evening, police and local officials said. Nobody was injured in the standoff.

A crack intervention squad brought in by helicopter handled the critical second phase of negotiations that "ended in freedom for the entire group without violence," Jean-Luc Prigent, a top aide in the local administration, told France-Info radio.

The atmosphere in the classroom was calm, with students sending cell phone text messages and calling their families, Stephane Bouillon, top official for the Sarthe region, told The Associated Press.

A school receptionist, Bernadette Mercier, told AP earlier that the man had promised not to harm the students, ages 16 to 18, who were held in an upper-floor study hall.

Mercier said the former teacher had been "very, very depressed" two years ago because of personal problems and now was apparently seeking work. School officials allowed him to enter because they knew him, she said.

"He promised a teacher's assistant that he would do no harm to the students," Mercier said by telephone, adding that he appeared calm.

Police had taken up positions around the school, and elite forces headed there via helicopter from a military airport west of Paris, police said. Interior Minister Nicolas Sarkozy, on a visit to Guadeloupe, said he was following the situation closely.

The receptionist, who was not in the same building as the hostages, said the incident began about 2:30 p.m.

"We knew him, so we simply let him in," she said. "He seemed totally normal."

Mercier, who did not identify the gunman, said the school has about 1,500 students.

Prosecutor Jean Elek informed families of students held hostage of the situation, Le Mans court officials said. A crisis center for parents was set up on the school grounds.

Police cordoned off the area in Sable-sur-Sarthe, outside Le Mans. The city famed for its 24-hour annual car race is about 145 miles southwest of Paris, and Sable-sur-Sarthe is about 30 miles from Le Mans.