A man carrying four handguns invaded the primary school in this small Scottish town this morning and killed 16 children -- 5- and 6-year-old kindergartners -- and their teacher in the school gym before killing himself. Another 12 children and three adults were wounded in modern Britain's deadliest mass assault. "The bodies of small children were all over the room, in every corner," said Dr. Jack Beattie, one of the first physicians to arrive at the scene. "Most of the children and the teacher were shot at close range, in the front of their heads, their chests, their abdomens or their limbs," he said. "Some were shot only once; others, two or three times."

The killer, identified by police as Thomas Hamilton, 43, was an organizer of boys' clubs in the area who had been dismissed as an adult leader of a local Boy Scout troop 20 years ago for "improper behavior." He reportedly had recently written Queen Elizabeth II -- the royal patron of Britain's scouts' organizations -- complaining of his treatment.

Hamilton also was known here as a collector of guns and of photos of boys wearing underwear and, according to local teenagers, was considered "the weirdo" of Dunblane and the neighboring town of Stirling. By late tonight, police had established no motive for a killing frenzy that sent Dunblane, Scotland and the rest of Britain into deep shock, with many people voicing the refrain: "Things like this don't happen here."

Police and witnesses said the man walked onto the school grounds around 9 a.m. and shot at least two adults as he made his way -- apparently purposefully -- to the small school gym. There, without speaking, he opened fire on Gwen Mayor, the teacher, and her class of 29 kindergartners and continued firing for roughly two minutes before shooting himself. Only one of the 29 children was not struck by gunfire, and five were reported in critical condition tonight.

"The incident started in the playground and continued inside the school," Chief Police Superintendent Louis Munn told a news conference. "I think several people saw him; I don't think they had the opportunity to challenge him."

Children interviewed today said they heard the shots throughout the school but, like Joan Nelson, 8, thought the noise was coming from workmen repairing the roof. But as soon as teachers realized what was happening, they gathered their pupils together and led them to cover wherever they could find it.

"My teacher grabbed me, and we hid behind her desk" in a classroom, Joan said. "Keep calm; don't panic," the girl said her teacher told her over and over as they hid in fear. "She was very confused, and I was very scared," Joan said.

The little girl added that Mayor had been her "favorite teacher. She was very kind, very caring."

An unnamed 11-year-old boy from the school described how Hamilton emerged from the gymnasium, still firing bullets that shattered glass in classroom windows.

"He was coming toward me, so I just dived under my desk when he turned and fired at us," the boy told the Associated Press. "The firing was very fast, like someone hitting a hammer quickly. Then there were a few seconds of a pause and they started again."

Police, headquartered just a few hundred yards away, arrived within a few minutes, followed closely by doctors, paramedics, ambulances and, later, helicopters.

They found a scene of horror. The gym was "completely silent," said Beattie, the physician. "Teachers were comforting the children who were still alive," he said. The youngsters "were very quiet. They were in shock."

Dunblane is an ancient town of 7,300 in central Scotland, an hour's drive east of Glasgow. It is known for its cathedral and its proximity to the William Wallace Memorial, a tower celebrating the medieval Scottish hero, high on the hills in prosperous, rolling countryside. Hamilton lived in Stirling, about five miles west of here. According to the British Scouting Organization, he served as a scout leader in 1973 and '74, before complaints from parents brought his dismissal -- a blow from which he apparently never recovered. He had reapplied for scout leadership unsuccessfully in 1988 and had written the queen just five days ago to complain about it.

In the intervening years, according to local officials and teenagers in Dunblane, he had organized his own boys' clubs, taking youngsters on outings to camps and scenic spots, such as Loch Lomond.

Some of these activities drew complaints from parents as well. Hamilton reportedly insisted on photographing boys in striped underwear he provided for them, keeping a collection of the photos on a wall of his home.

Gun ownership is tightly restricted in Britain, with only 75 firearms deaths reported last year in a nation of 55 million people. Automatic and most semi-automatic weapons are banned; for other firearms, laws here require strict licensing and police checks on the fitness of applicants for gun ownership. Police said tonight that Hamilton had a gun permit; they also said they had periodically investigated him following allegations of child abuse but had not found sufficient evidence for prosecution.

As word spread of the massacre at the school, parents rushed to the scene, which had been cordoned off by police. Some left weeping and stricken. Others scurried home with their children or to improvised counseling centers set up in nearby homes by authorities and clergy. Bouquets of flowers were laid near the scene.

Robert Weir, the parent of a child who was wounded, said his son "just told me that someone came busting in shooting. . . . Other than that, he's been very quiet. He doesn't know the extent of what's happened."

Following the killings, Dunblane shut down. Shops closed early. Local TV programming was suspended. A morgue was set up in the school, and tonight parents filed in to make formal identifications for police.

The queen, Prime Minister John Major and other British and Scottish leaders expressed horror at what had happened. "I am am sure I share in the grief and horror of the whole country," the queen said in a statement. The House of Commons interrupted its business for a moment of mourning. "This is a close-knit community," said George Robertson, a Labor Party member of Parliament from the area. "All of my children went to this school," he said. "This is so terrible, there are no words I can find to describe it." CAPTION: Parents embrace their daughter, who escaped injury when a gunman opened fire in a Scottish primary school. CAPTION: A police officer, above, is overcome outside the Dunblane school where a gunman killed 16 children and teacher Gwen Mayor, shown at left in an undated but recent class photo. The identities of the victims or of the children in the class photo were not immediately available. CAPTION: Family members gather outside Dunblane's primary school, where parents had to identify their children for police.