"No faith justifies these murderous and craven acts; no just and loving God looks upon them with favor," Obama told the crowd on a steamy Texas afternoon. "And for what he has done, we know that the killer will be met with justice -- in this world and the next."
He did not name Maj. Nidal Hasan, the military psychiatrist accused of the killings.
As for the victims and the soldiers who rushed to help them, Obama said, "We need not look to the past for greatness, because it is before our very eyes." He spoke at a memorial service before a crowd estimated at 15,000 on this enormous Army post.
The president and first lady Michelle Obama began an afternoon of consolation by meeting privately with family members of those killed last week and with those wounded in the attack and their families. Obama used his public remarks to put a human face on those who perished, victims ranging in age from 19 to 62. He also used his platform to speak indirectly to questions about whether the alleged shooter had ties to extremist Islamic ideology.
Thousands upon thousands of people, many of them soldiers dressed in camouflage, gathered to pay their respects and hear the president. The shooting killed 12 soldiers and 1 civilian, injured 29 others and left a nation stunned and searching for answers.
Below the stage where Obama spoke was a somber tribute to the fallen -- 13 pairs of combat boots, each with an inverted rifle topped with a helmet. A picture of each person rested below the boots. After the ceremony, Obama walked solemnly along the row of boots, placing a commander in chief's coin next to each victim's photo in tribute.
Even as Obama honored the dead, there was government finger-pointing over what had been known about Hasan and whether he should have been investigated further.
U.S. officials said a Pentagon worker on a terrorism task force had looked into Hasan's background months ago and had concluded he did not merit further investigation. Two officials said the group had been notified of communications between Hasan and a radical Islamic imam overseas and the information had been turned over to a Defense Criminal Investigative Service employee assigned to the task force. The two spoke on condition of anonymity because they were not authorized to discuss the investigation.
Obama remembered the slain not as shooting victims but as husbands and fathers, immigrants and scholars, optimists and veterans of the war in Iraq. He cited one woman who was pregnant when she was gunned down.
The president spoke to loved ones left behind, saying: "Here is what you must also know: Your loved ones endure through the life of our nation."
"Every evening that the sun sets on a tranquil town; every dawn that a flag is unfurled; every moment that an American enjoys life, liberty and the pursuit of happiness -- that is their legacy," he said.
He named and described each victim, including Chief Warrant Officer Michael Cahill, a physician's assistant back at work just weeks after having a heart attack; Maj. Libardo Eduardo Caraveo, who spoke little English when he arrived in the United States from Mexico but earned a Ph. D and helped combat units cope with the stress of deployment; Pfc. Aaron Nemelka, an Eagle Scout who signed up "to do one of the most dangerous jobs in the service -- defuse bombs."
Later, the president and first lady went to a military hospital to meet with those still recovering from wounds incurred during the attack.
The ceremony unfolded in a field at the headquarters of the massive post, cordoned off with walls of steel shipping containers. Many soldiers in the crowd listened intently to Obama's speech, standing stoically, some with heads bowed.
Sheila Wormuth, whose husband is stationed at Fort Hood, came with her 3-year-old daughter to show their support. While her husband wasn't at the shooting site, she said, "what happens to my husband's brothers and sisters happens to us."
Bonita Childs, 46, drove 30 miles to attend the ceremony, even though she had no connection to Fort Hood.
"I wanted to be a part of it," she said. "Our soldiers give so freely of themselves for the freedom we enjoy, and I thought coming here today and showing my gratitude was the least I could do."
It was Obama's moment to take on the job of consoler-in-chief, a role that can help to shape a presidency at a time of national tragedy.
The president has tried to strike a balanced tone: He has promised a full investigation of the Fort Hood shootings but has said little about it as investigators search for a motive. He said Tuesday it was "hard to comprehend the twisted logic that led to this tragedy."
It wasn't even two weeks ago that Obama stood in the dark of night at Dover Air Force Base in Delaware, honoring the remains of 18 troops killed in Afghanistan. Now he led the mourning for 13 men and women who were working in the one place, as Obama put it, that "our soldiers ought to feel most safe."
When Obama returns to Washington, the cost of war will still be with him.
His agenda Wednesday: another war council meeting on Afghanistan, and laying a Veterans Day wreath at Arlington National Cemetery.