Last paragraph reads: "Bernadette Mercier, the school receptionist, said the former teacher had been"very, very depressed"two years ago because of personal problems."

Paragraph 2 reads: "Nicolas Vilpail, 33, was on medication and apparently under the influence of alcohol during the four hours he held 21 students and two aides captive, authorities said. A government official said Vilpail had made 'paranoiac demands.'"

SABLE-SUR-SARTHE, France (AP) A former teacher armed with a handgun that fires rubber bullets surrendered peacefully Thursday after taking nearly two dozen people mostly students hostage in a classroom at his former school in western France, officials said.

Nicolas Vilpail, 33, was on medication and apparently under the influence of alcohol during the four hours he held 21 students and two aides captive, authorities said. A government official said Vilpail had made "paranoiac demands."

No one was injured.

Vilpail had taught at the Colbert de Torcy High School until two years ago, school officials said. He was armed with a gun that fires rubber bullets, police said, adding that the weapon was nevertheless dangerous. He surrendered after hours of negotiations, said Jean-Luc Prigent, a top aide in the local administration.

Education Minister Gille de Robien said Vilpail had resigned of his own accord from the national education system in November. It was unclear whether he had taught elsewhere over the past two years.

The minister, who went to the school, said the drama ended peacefully in part because of the calm, responsible behavior of the students, aged 16 to 18.

One of two teacher's aides taken captive said Vilpail appeared "calm and terribly depressed."

"His explanations for doing this were incoherent," said the woman, identifying herself only as Celine. "He asked us to call a maximum (number) of journalists with our cell phones."

An elite police unit flown in by helicopter handled the critical second phase of negotiations that "ended in freedom for the entire group without violence," Prigent told France-Info radio.

The atmosphere in the classroom was calm, with students sending text messages and contacting their families by cell phone, Stephane Bouillon, top official for the Sarthe region, told France-3 television.

The school in Sable-sur-Sarthe is about 30 miles from Le Mans, the city famed for its 24-hour annual car race some 145 miles southwest of Paris.

Bouillon, prefect of the Sarthe region, said the man was on medication, apparently under the influence of alcohol and making "paranoiac demands."

"But we also know that he did not want to hurt the children, that he had the reflexes of a teacher who respects his students," Bouillon said.

Among other things, the hostage-taker believed he was the victim of a coup d'etat, Bouillon said. He had demanded a meeting with former Education Minister Francois Fillon, senator for the region and former mayor of Sable-sur-Sarthe.

A school employee said the gunman, who was looking for work, had promised early on not to harm the students, held in an upper-floor study hall.

The police unit that arrived on the scene determined the number of captives by slipping a paper under the door and asking them to write their names on it, said Dominique Dezecot, spokeswoman for the prefecture.

The paper was signed by 21 students and two teacher's aides, she said.

Bernadette Mercier, the school receptionist, said the former teacher had been "very, very depressed" two years ago because of personal problems.