Updated

In his first address during a time of national mourning, President Obama on Tuesday hailed the victims of the deadly Fort Hood shooting as heroes, saying "no words can fill the void that has been left."

Obama, who traveled to Texas to console survivors and family members of victims of the deadly massacre that killed 13 and wounded 29 last week, said, "We come together filled with sorrow for the 13 Americans that we have lost, with gratitude for the lives that they led, and with a determination to honor them through the work we carry on."

Obama said the memory of those who died "will be honored in the places they lived and by the people they touched."

"It may be hard to comprehend the twisted logic that led to this tragedy. But this much we do know -- no faith justifies these murderous and craven acts, no just and loving God looks upon them with favor. And for what he has done, we know that the killer will be met with justice -- in this world, and the next," Obama said.

The president met privately with the families of those killed before addressing a memorial service watched by American troops around the world.

Nearly 15,000 people, many of them soldiers dressed in their camouflage uniforms, gathered to pay respects and hear the president.  At the front of the platform stage stood a row of battlefield crosses and the traditional tribute to a fallen soldier: pairs of boots, with a rifle protruding from them and a combat helmet resting atop the weapon. In front of each pair of boots was a photo of each victim.

"Their life’s work is our security, and the freedom that we too often take for granted. 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," Obama said, before mentioning each of the 13 victims by name.

Obama, with the first lady at his side, laid his presidential coin before each victim's photograph following his address -- upholding a long-standing military tradition.

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.

The visit marks Obama's first test at consoling Americans during a time of national tragedy -- a skill that can help shape a presidency.

Obama's predecessor, George W. Bush, governed during the worst terrorist attack on American soil, the most crippling natural disaster in U.S. history, a space shuttle explosion, a shooting rampage at Virginia Tech, a tornado that wiped away a Kansas town, a bridge collapse in Minnesota, Midwestern flooding and California wildfires. Each response affected his standing, for better or worse, in a country that expects its president to be empathetic and clearly in charge.

Bush and his wife Laura secretly visited Fort Hood after the shooting and spent time consoling those who were wounded in the shooting spree. The Bushes, who have a 1,600-acre property known as Prairie Chapel Ranch less than 30 miles from Fort Hood in central Texas, spent between one and two hours visiting the wounded and their families.

History is full of other examples. Bill Clinton helped rebuild his troubled presidency with the way he reacted to the Oklahoma City bombings.

In this case, Obama has sought his own balance.

He has promised a full investigation of the Fort Hood shootings but has said little about it as police search for a motive. He has praised religious diversity in the military, trying to offer calm as questions loom about whether the alleged shooter had ties to extremist Islamic ideology. And he has delayed a trip to Asia to attend the memorial service.

"This is an ongoing joint investigation, and the president has asked every agency involved and everybody that would have come -- would have had some purview over this to investigate why this happened, how this happened, and to ensure that they can tell him that it won't happen again," White House Press Secretary Robert Gibbs told reporters aboard Air Force One on Tuesday.

The mass killing shook the nation even more because it happened in a presumed haven of U.S. security. The suspect himself is a soldier, Maj. Nidal Malik Hasan. Authorities say he fired off more than 100 rounds before a civilian police officer shot him. He survived and is in stable condition.

Among those killed at Fort Hood were 21-year-old Pvt. Francheska Velez, who was pregnant and preparing to return home after a recent deployment in Iraq. And Spc. Jason Hunt, a 22-year-old who served in Iraq and was married two months ago. And Maj. Libardo Caraveo, 52, who was headed to the war zone in Afghanistan.

Obama's presence alone will be meaningful to those hurting at Fort Hood, said Kevin Sullivan, who served as Bush's communications director.

"It sends a message that he understands this is a national moment," Sullivan said. "But what really matters is that the president is able to provide some comfort to the sons and daughters and husbands and wives of the victims. That's ultimately why he's going. He's saying, 'The whole country grieves for you."'

Click here to read the full transcript of Obama's remarks.

Fox News' Bill Sammon and Eve Zibel and the Associated Press contributed to this report.