ANSBACH, Germany - An 18-year-old armed with an axe, knives and Molotov cocktails attacked his high school in southern Germany, injuring eight pupils and a teacher before police shot and arrested him, authorities said.

As the mayhem erupted Thursday on the third floor, roughly 700 other students fled the building, including some who barricaded a classroom door before running down an emergency staircase. Many took shelter in a nearby office building.

The teenager entered the four-story school in Ansbach at 8:30 a.m. (0630GMT), shortly after classes started, Bavarian Interior Minister Joachim Herrmann said.

He climbed to the third floor, where he lit a Molotov cocktail and threw it into an 11th grade classroom, apparently striking a girl in the head and burning several other people, authorities said.

He then attacked some nearby girls with the axe, inflicting serious skull wounds on one of them, said Udo Dreher, the top police officer at the scene.

Dreher said it was not clear if the attacker, who had no police record, purposely selected his victims.

The teen, who was in his final year at the school, later lobbed another Molotov cocktail into a ninth-grade classroom directly across the hall, but it failed to ignite, Dreher said.

A student who smelled smoke called police, pulled the fire alarm, and doused the flames, officials said.

Police searching the building were confronted by the teenager.

"The attacker was armed with an axe, several knives and another Molotov cocktail," said Dreher. "As he moved toward the officers, they opened fire and then arrested him."

The attacker was shot five times in the upper body during his arrest, which authorities said came 11 minutes after police were alerted. He remains in critical condition, officials said, though Dreher said his life was not in danger. Police did not identify him.

One teacher and six pupils suffered burns, police said, but none of their injuries was serious.

About 700 other pupils were able to evacuate the building, taking shelter in a nearby unemployment office where they were being treated by psychologists and counsellors, officials said.

Jakob Breitzke, a 10th-grader, told n-tv private television that students in his class heard screaming coming from the third floor and locked and barricaded their classroom door. He said someone rattled the door before moving on.

"Then we ran out down the emergency stairs and over to the unemployment office," Breitzke said.

He described the attacker as a loner but someone who "was not a typical killer-(video-) games player. ... No one would have expected that he would go after people or plan an attack like this."

School principal Frank Stark said the evacuation went smoothly after the fire alarm sounded, and many students thought it was only an exercise.

Prosecutors said they are investigating the teen on suspicion of attempted murder. Authorities said his motive was not immediately clear, and there was no indication that he had said anything during the attack.

Police spokeswoman Elke Schoenwald said a search of the 18-year-old's room turned up documents that "suggest a planned act." She did not elaborate, saying that they are currently being evaluated.

"As horrible as an incident such as this is, it has shown that the school and police were well prepared for such a situation," Herrmann said.

According to its Web site, Carolinum is the second-oldest public high school in Bavaria. It is located among winding cobbled streets, and offers a curriculum based on the humanities and music for grades five through 13.

The incident was the second attack on a school in Germany this year.

In March, 17-year-old Tim Kretschmer fatally shot 12 people at his former school in the southwestern town of Winnenden. He fled the building and killed three more people before turning the gun on himself.

That was the nation's second-worst school shooting after a 2002 shooting spree in Erfurt that left 17 dead, including the gunman.

After Kretschmer's attack in Winnenden, Germany moved to tighten checks on gun owners.


Associated Press Writer Melissa Eddy contributed to this report from Berlin.