Police in Germany are investigating why a teenage gunman went on a shooting spree that began at his former school and ended with the loss of 16 lives.

They are likely to probe speculation that 17-year-old Tim Kretschmer deliberately targeted girls - 11 of the victims at the school were female.

The teenager eventually shot himself after a shoot-out with police.

Flags are flying at half-mast across Germany for those killed in the south-west towns of Winnenden and Wendlingen.

See where the school shooting took place

Chancellor Angela Merkel called the incident "incomprehensible", and said the whole nation was in mourning.

Hundreds of people took part in emotional church services in Winnenden, where the school is located, to remember the victims.

'No grudge'

Investigators have been examining the computer and personal belongings of Tim Kretschmer to find out his motivation for the killing spree.

TIM KRETSCHMERPhoto of Tim Kretschmer from Bild ZeitungLeft Albertville school last year after passing exams (pictured above in 2004)Officials said he was an ordinary pupil who had received good reports from schoolGerman media reported he had begun an apprenticeshipLived in the village of LeutenbachA keen table-tennis player, who aspired to become professional

How school shooting unfoldedAttack raises gun-law questionsBoy was 'arrogant, not aggressive'

Officials say it currently seems the 17-year-old did not hold a grudge against the school.

"There are no indications at the moment of any warning of suggestion that the attack could have been foreseen," Baden-Wuerttemburg's Interior Minister Heribert Rech said.

"It is conspicuous that most of his victims were female," he said, but added that he did not want to speculate about possible motives.

Mr Rech described Kretschmer as an unremarkable student who had gained average grades at school and was enrolled on a course to be a salesman.

Some former schoolmates have described him as a shy loner who never had a girlfriend, struggled to fit in and spent all day on his computer.

But one fellow student, Eileen Toramen, said he was a normal guy who had friends, good grades and future prospects.

"He was an average, totally normal guy," she said.

"He didn't really stand out, he wasn't a recluse either. He was totally normal, he was also nice, sweet."

'Panic and shock'

Heribert Rech said it appeared Kretschmer had used a gun registered to his father, a member of a shooting club with a collection of 15 guns.

"But one weapon was not stored in the safe, but was lying at another place, in the bedroom," he told reporters.

People embrace at a church service in WinnendenThe town of Winnenden, along with the rest of the country, is in shock

"So, the young offender must have taken the gun from the bedroom."

The teenager entered the Albertville secondary school, north of Stuttgart, dressed in black combat gear, at 0930 (0830 GMT) on Wednesday.

Eight girls and one boy were killed after he opened fire, along with three teachers, all of them women. Seven other children suffered minor injuries.

According to reports, he returned to one classroom three times. On the last visit, he asked: "Aren't you all dead yet?"

As Kretschmer fired at students, terrified pupils leapt from the school windows to escape.

A student called Celina told the BBC how the gunman had come into her classroom and "just shot everywhere".

"I threw myself on the floor and took my friends with me, and then I went to a corner and put a table in front of me, and he came again a second time and shot again," she said.

"We were in panic and in shock."

Some 60 spent rounds of ammunition were later found in the school.

As he fled the school, the gunman killed a passer-by.

He hijacked a car, taking its driver hostage, before stopping in the town of Wendlingen, about 40km (25 miles) away from the school.

He then shot and killed two men at a car showroom.

A fire-fight with police followed and the teenager was hit in the leg.

He fled and turned the weapon on himself.

Wednesday's attack was the most deadly school-shooting in Germany since 2002, when a former school pupil in the eastern city of Erfurt killed 14 teachers, two pupils and a police officer.

why the fuck do these ugly bastards who never had sex in their lives and only play videogames keep doing this because they had a bad youth? damnit, get over it and make something of your life instead of destroying others.

LMAO.YOU are talkin about ugly guys ?

you call me ugly, what a surprise, wow, I feel so ugly right now, you are so right, you're absolutely right little boy. now go on and play