NEWTOWN, Conn. — President Obama on Sunday vowed to use “whatever power this office holds” in coming weeks to prevent mass shootings like the one that killed 26 people at an elementary school last week, 20 of them small children.

Obama, speaking to hundreds of mourners assembled at Newtown High School, said he would gather law enforcement officials, educators, and mental health workers to find ways to prevent future shootings. As he spoke, many in the audience sobbed, clutched teddy bears or hugged their children.

“We can’t tolerate this anymore. These tragedies must end,” the president said in a televised speech that lasted nearly 20 minutes. “And to end them, we must change. We will be told that the causes of such violence are complex and that is true. No single law, no set of laws can eliminate evil from the world or prevent every senseless act of violence in our society, but that can’t be an excuse for inaction. Surely we can do better than this.”

Advertisement - Continue Reading Below

The president had wept Friday when told of the shootings, but on Sunday he spoke with somber resolve. He offered few details, but made clear that politics should not trump public safety, and that America had to act to protect its children.

“Are we really prepared to say that we’re powerless in the face of such carnage, that the politics are too hard?” he asked. “Are we prepared to say that such violence visited on our children year after year after year is somehow the price of our freedom?”

To make his point, he read the names of each victim. At the end, the crowd gave him a standing ovation.

Hundreds gathered outside Newtown High School during the vigil, listening to Obama, other speeches and prayers as they held candles and American flags. As Obama spoke, the crowd outside stood quietly and sheltered their candles from the wind.

The president’s address followed reports that the 20-year-old killer, Adam Lanza, wore combat gear and brandished a semiautomatic weapon, handguns and a staggering cache of ammunition when he blasted his way into Sandy Hook Elementary School on Friday, raising the chilling possibility that the carnage might have been more extensive had police not arrived so quickly.

Authorities are still investigating the mass killings, but on Sunday the Connecticut medical examiner said Lanza’s mother, Nancy, was killed by multiple gunshot wounds to the head in their Newtown home. Then, authorities said, Lanza drove to the school, blasted through glass to get into the locked building, shooting two first-grade classes of 6- and 7-year-olds, with the powerful Bushmaster .223. He also killed the principal, a school psychologist, and four teachers.

Lanza shot himself in the head as police stormed the school minutes after the first urgent calls for help. The state medical examiner on Sunday ruled his death a suicide.

Connecticut State Police Lieutenant J. Paul Vance said Sunday that a motive in the shooting remained unclear but the swift police response probably halted Lanza.

“We know that those teams did rescue a number of people,” Vance said. “We’re sure that the gunman knew that the authorities were there and coming in to stop the threat.”

The shooting in the affluent, scenic town an hour southwest of Hartford stunned a nation and quickly reignited an impassioned national debate over gun control laws.

In Boston, Cardinal Sean P. O’Malley called in his Sunday homily for a ban on assault rifles and improved care for the mentally ill.

“What has happened in these days in Newtown, Connecticut, is a tragedy of almost biblical proportion,” the cardinal said.

Amid the bitter cold and rain on Sunday, Newtown descended into grief, wracked by unanswered questions. Police do not know what drove Lanza to don combat gear and head to the school with the Bushmaster, other guns, and hundreds of rounds of ammunition.

The 20-year-old loner had a suspected personality disorder but Vance said he knew of no known criminal record as of Sunday. It is also unclear why his mother, Nancy Lanza, had a cache of weapons at home.

The Associated Press, citing an anonymous law enforcement source, said Nancy Lanza was found in her pajamas in bed, with four gunshot wounds to the head from a .22-caliber rifle.

Lanza’s father, Peter Lanza, a General Electric executive, issued a statement saying his family was “heartbroken.”

“We are in a state of disbelief and trying to find whatever answers we can,” Lanza said. “We too are asking why.”

In Newtown on a cold and rainy Sunday, the grief unfolded in stark contrast to the garlands of holiday lights adorning the town.

Parishioners flooded St. Rose of Lima Church for services, interrupted briefly when someone phoned in a threat.

Over the weekend, the survivors and their families battled grief to share the stories of compassion and heroism of loved ones lost.

Victoria Soto, the 27-year-old teacher and daughter of a state worker, reportedly hid her students in a closet to save them. Emilie Parker, a charming 6-year-old, drew pictures and cards to comfort people who were sad. School Principal Dawn Hochsprung, 47, lunged at the shooter after he blasted a hole in a window to get in.

Many turned to the grim task of planning funerals.

The family of Noah Pozner, a 6-year-old victim, said services are scheduled for Monday.

Amid the mourning Sunday, an army of electricians, plumbers, painters and other volunteers descended on a shuttered middle school in the neighboring town of Monroe. They planned to reopen Chalk Hill school for Sandy Hook students starting on Wednesday, said Monroe Police Lieutenant Brian McCauley.

“They’re trying to restore as much of a sense of normalcy as possible. And normalcy comes with going to a safe and secure building,” McCauley said.

McCauley spoke Sunday as he watched scores of volunteers scrub floors, wipe windows and search for tables and chairs to accommodate small children. Police cordoned off the school, at the end of a long driveway, and will continue to guard it once school starts.

“We’re a small, New England town,” he said. “We work with our neighbors. Everybody pulls together.”

Connecticut Education Commissioner Stefan Pryor told the Associated Press on Sunday that it was ‘‘too soon to know’’ if the Sandy Hook school building will ever reopen.

In Massachusetts, some public schools will hold a moment of silence Monday as students return to class. Principals at Newton South High and Newton North High e-mailed announcements to the school communities over the weekend, assuring parents and students that security procedures were in place and offering tips on how to handle questions about the tragedy.

Boston and other school systems planned to increase police presence this week to reassure students and parents.