"I won't risk your lives unless it is absolutely necessary," Obama told service men and women at Naval Air Station Jacksonville. He promised a "clear mission" with defined goals and the equipment needed to get the job done.
Obama, who is in the process of weighing options put forward by the Pentagon that include various levels of increased troops, spoke of the latest example of the dangers and sacrifices there - helicopter crashes that killed 14 Americans in the deadliest day for the U.S. mission in Afghanistan in more than four years.
"Fourteen Americans gave their lives. And our prayers are with these service members, their civilian colleagues and the families who loved them," Obama said. "They were willing to risk their lives, in this case to prevent Afghanistan from again becoming a safe haven for al Qaeda and its extremist allies."
His visit to the naval air station came after he met at the White House with his national security team for a sixth full-scale conference on the future of the faltering war.
Waves of boisterous cheers greeted the president. Obama noted that representatives of all of America's military services attended the gathering.
The administration is debating whether to send tens of thousands more troops to the country, while the Afghan government is moving to hold a Nov. 7 runoff election between President Hamid Karzai and challenger Abdullah Abdullah. The runoff comes after complaints by international monitors of fraudulent voting in the first election.
But Obama did not tip his hand on how he might decide.
"I will never rush the solemn decision of sending you into harm's way," he said.
If it is necessary, Obama added, "we will back you up to the hilt."
Framed by dozens of white-uniformed sailors, Obama stood on a stage under a huge American flag.
"By being here, you join a long, unbroken line of service at Jacksonville - naval aviators from World War II to Korea to Vietnam, among them a great patriot named John McCain," he said.
McCain, the former Navy pilot and Vietnam prisoner of war and now senator from Arizona, was Obama's Republican presidential opponent. McCain's family lived in Jacksonville for several years while he was a prisoner of war. Upon his release, he lived here, serving as a commanding officer of his squadron.
"Thank you for reminding us of the country we can and must always be," Obama told the troops.