"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.
Even as Obama honored the dead, there was government finger-pointing over what had been known about shooting suspect Maj. Nidal Hasan's background 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 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 planned to go to a military hospital to meet with those still recovering from injuries incurred during the attack.