A heavily armed man opened fire inside a Connecticut elementary school Friday leaving 27 dead — including 20 children — and forcing students to cower in classrooms and then flee with the help of teachers and police.

The gunman, who committed suicide at the school, was counted among the dead, authorities confirmed.

Lt. Paul Vance said 18 children were pronounced dead at the school as well as six adults and the shooter. The principal was believed to be among the victims.

Two other children were transported to hospital but were pronounced dead. A woman who worked at the school was also wounded.

Vance said another adult was found dead at a "secondary crime scene" in Newtown, which police discovered while investigating the gunman.

An unidentified source later told The Associated Press that the gunman killed his mother at her house, before heading to the school. 

Vance said the shooting took place in two nearby classrooms at Sandy Hook Elementary School, which has students in kindergarten to Grade 4, in the community of 27,000 located 95 kilometres northeast of New York City.

si-connecticut-school-shooting-300-ap-03728337

In this photo provided by the Newtown Bee newspaper, state police lead children from the Sandy Hook Elementary School in Newtown following Friday's shooting. (Shannon Hicks/Newtown Bee/Associated Press)

Parents have not yet been given access to the bodies of their children, Vance told media Friday evening. He said it would take time to positively identify the victims, which could happen tomorrow.

Investigators will be at the school until at least Sunday combing through the evidence, he added. 

The shooting was the nation's second-deadliest school shooting, exceeded only by the Virginia Tech massacre in 2007, which left 32 people and the gunman dead.

Speaking at a press conference Friday afternoon, Connecticut Gov. Dan Malloy said that it is a terrible day for the community.

"Evil visited this community today, and it's too early to speak of recovery" he told reporters. "But Connecticut, we're all in this together."

Several vigils were held across the country following the shooting. People gathered in front of the White House in Washington, D.C., and an impromptu vigil took place in Times Square in New York City.

Hundreds also gathered Friday evening at St. Rose of Lima Church in Newton to mourn victims of the massacre, filling it to capacity and spilling outside. Some of them held hands in circles and prayed, while others lit candles and sang Silent Night.

Brother of alleged gunman questioned

Although police have not yet officially named the shooter, an unidentified law enforcement official told The Associated Press it was 20-year-old Adam Lanza.

At least one parent said that his mother, Nancy Lanza, was a substitute teacher at the school, but her name did not appear on a staff list, The AP reported.

Lanza's older brother, 24-year-old Ryan, of Hoboken, N.J., was being questioned, but a law enforcement official said he was not believed to have had a role in the rampage. Investigators were searching his computers and phone records, but he told law enforcement he had not been in touch with his brother since about 2010.

Earlier, a law enforcement official mistakenly identified Ryan as the shooter.

Lt. Vance confirmed that local police are in contact with authorities in New Jersey.

The gunman drove to the school in his mother's car, a second official said. Three guns were found: a Glock and a Sig Sauer, both pistols, inside the school, and a .223-calibre rifle in the back of a car.

Authorities also recovered three other guns: a Henry repeating rifle, an Enfield rifle and a shotgun. It was not clear exactly where those weapons were found.

Obama: 'Too many of these tragedies'

A visibly emotional President Barack Obama said the United States had endured "too many of these tragedies."

"The majority of those who died were children — beautiful, little kids between the ages of five and 10 years old," Obama said during a press conference Friday afternoon..

"These neighbourhoods are our neighbourhoods, and these children are our children, and we’re going to have to come together and take meaningful action to prevent more tragedies like this, regardless of the politics," Obama said.

Parents flooded to Sandy Hook Elementary School looking for their children in the wake of the shooting. Students were told by police to close their eyes as they were led from the building. 

A photo taken by the Newtown Bee newspaper showed a group of young students — some crying, others looking visibly frightened — being escorted by adults through a parking lot in a line, hands on each other's shoulders. 

Newtown, connecticut

'Everyone was just traumatized'

Authorities gave no details on exactly how the attack unfolded. But a custodian ran through the halls, warning of a gunman on the loose, and someone switched on the intercom, alerting people in the building to the attack — and perhaps saving many lives — by letting them hear the hysteria going on in the school office, a teacher said.

Teachers locked their doors and ordered children to huddle in a corner or hide in closets as shots echoed through the building. 

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." 

He said the shooter didn't say a word. 

Stephen Delgiadice said his eight-year-old daughter heard two big bangs and teachers told her to get in a corner. His daughter was fine. 

"It's alarming, especially in Newtown, Conn., which we always thought was the safest place in America," he said. 

Danbury Hospital was the only hospital to take in victims from the shootings, admitting three patients. Doctors said at a news conference they cleared four trauma rooms to treat shooting victims.  

Mergim Bajraliu, 17, heard the gunshots echo from his home and raced to check on his nine-year-old sister at the school. He said his sister, who was fine, heard a scream come over the intercom at one point. He said teachers were shaking and crying as they came out of the building. 

"Everyone was just traumatized," he said. 

'There's no words'

Richard Wilford's seven-year-old son, Richie, is in the second grade at the school. His son told him that he heard a noise that "sounded like what he described as cans falling."  

si-shooting-cell-phone-300-

A number of family members of students and teachers waited for news of their loved ones outside the Sandy Hook Elementary School in Newtown, Conn. (Jessica Hill/Associated Press)

The boy told him a teacher went out to check on the noise, came back in, locked the door and had the kids huddle up in the corner until police arrived.  

"There's no words," Wilford said. "It's sheer terror, a sense of imminent danger, to get to your child and be there to protect him."  

Melissa Makris, 43, said her 10-year-old son, Philip, was in the school gym.  

"He said he heard a lot of loud noises and then screaming. Then the gym teachers immediately gathered the children in a corner and kept them safe in a corner," Makris said.  

The fourth-grader told his mother that the students stayed huddled until police came in the gym. He also told her that he saw what looked like a body under a blanket as he fled the school. 

"He said the policeman came in and helped them get out of the building and told them to run," Makris said. "And they ran to the firehouse."  

On Friday afternoon, family members were led away from the firehouse, some of them weeping. One man, wearing only a T-shirt without a jacket, put his arms around a woman as they walked down the middle of the street, oblivious to everything around them.   

Another woman with tears rolling down her face walked by carrying a car seat with a young infant inside and a bag that appeared to have toys and stuffed animals.

With files from CBC News