(AP) President Barack Obama marked the 14th anniversary of the Sept. 11 terror attacks with a visit to Fort Meade, Maryland, in recognition of the military's work to protect the country.

Obama told military service members that the anniversary of the attacks is a solemn day and he wants to use it to make sure those killed are never forgotten.

He met with troops and took questions through social media from those stationed overseas. He reassured the troops that the U.S. must work to make sure that the men and women in uniform have the strategy and resources they need to succeed.

The president told the crowd that he remembers sitting down on the evening of Sept. 11, rocking his baby daughter Sasha to sleep and sensing for the first time in his life that the U.S. homeland was vulnerable.

Obama was a state senator in Illinois when the terror attacks occurred. He told the troops the destruction that day shows "just how precious what we have is and the need for us to defend it at any cost."

He also said he remembers and gives credit to President George W. Bush for going to the World Trade Center site and throwing out the first pitch at Yankee Stadium after the attacks. He said he recalls thinking as he watched that people are Americans first, not Republicans or Democrats, or Texans or Californians, and that they all had to unite for the country.

Obama said the country still faces significant threats, including from the Islamic State group forces in the Middle East.