A gunman has killed 26 people, including 20 young children, and then himself at a US school where his mother worked in one of the worst school shootings in the country's history.

Frightened pupils who were rushed from the building by police were told to close their eyes.

"Our hearts are broken today," President Barack Obama said, wiping his eyes during an emotional briefing from the White House.

He said the children killed in the attack at Sandy Hook Elementary School in Newtown, Connecticut, were aged between five and 10 years old. He said the nation had been "through this too many times" and has to come together to take meaningful action, "regardless of the politics".

The suspect, 20-year-old Adam Lanza, was dead from a self-inflicted gunshot wound, and his older brother Ryan, 24, was being held for questioning as a possible second shooter. An earlier report from a law enforcement official mistakenly transposed the brothers' first names.

The law enforcement official said the boys' mother, Nancy Lanza, worked at the school as a teacher and was presumed dead.

State police said 18 children were found dead at the school and two were later declared dead, and six adults were found dead at the scene. They said the shootings occurred in one section of the school but did not give details. Police also said another person was dead at a second scene. Governor Dannel P Malloy said someone who lived with the gunman died.

Robert Licata said his six-year-old son was in class when the gunman burst in and shot the teacher. "That's when my son grabbed a bunch of his friends and ran out the door," he said. "He was very brave. He waited for his friends." Mr Licata said the gunman did not say a word.

The law enforcement official also said Lanza's girlfriend and another friend were missing in New Jersey. According to the official, the suspect drove to the school in his mother's car. Three guns were found - a Glock and a Sig Sauer, both pistols, and a .223-calibre rifle. The rifle was recovered from the back of a car at the school, and the two pistols were recovered from inside the school.

State police said only students and school staff were killed, but they refused to say how people were dead. Police said the scene was secure. The attack, just two weeks before Christmas, was the latest of several mass shootings in the US this year, and approached the deadly scale of the Virginia Tech university massacre in 2007 in which 32 died.