-President Barack Obama carried the debate over national security to the U.S. Naval Academy on Friday, telling graduating midshipmen that America's fundamental values and principles "help keep us safe."

In his first service-academy commencement speech, Obama promised the graduates that he would never send them into harm's way without the strategy, "well-defined goals," equipment and support they needed.


Warm weather, a sun-filled sky and a light breeze provided near-perfect conditions for the event at Navy-Marine Corps Stadium, where the 1,036 midshipmen and about 29,0000 family, friends, alumni and VIPs had gathered.

Obama told the crowd that the U.S. must remain on guard against a full range of security threats: "The conventional and the unconventional. The nation-state and the terrorist network. The spread of deadly technologies and of hateful ideologies. Eighteenth-century-style piracy and 21st-century cyber threats."


And in an echo of remarks delivered a day earlier at the National Archives, he spoke at length about values.

He drew applause when he said that "as Americans, we reject the false choice between our security and our ideals. We can and we must and we will protect both."

Obama, the first African-American commander-in-chief, congratulated the Naval Academy for increased diversity as he faced a graduating class that was 20 percent female and more than 20 percent minority. Less than 5 percent of the Class of 2009 is African-American, according to academy statistics.

Obama singled out four midshipmen for special praise, including Sad? A. Holder.

He hailed Holder, who came to the U.S. from Trinidad as a teenager, for her "patriotism," which earned her "the titles she values most - U.S. citizen and Navy midshipman and, today, ensign."

The 24-year-old, whose mother, Mary Holder, is a home health aide in Baltimore, was serving in the Navy when she applied to and was accepted at the Naval Academy. She graduated with a 4.0 grade-point average and a degree in quantitative economics.

Holder said in an interview that, as an immigrant, she was "super-excited to be mentioned in the commencement speech.

"A lot of hard work, and it paid off," she said.


The president's appearance in Annapolis came one day after he delivered a high-profile defense of his anti-terror policies, facing off in a virtual debate with former Vice President Dick Cheney, who made a speech of his own, on the subject of detainees.

From a temporary stage set up on the artificial turf of the stadium's playing field, Obama alluded to his earlier remarks, pointing out that the oath the midshipmen took Friday as they became officers was similar to the one he took in January.

"We uphold our fundamental principles and values not just because we choose to, but because we swear to. Not because they feel good, but because they help keep us safe," the president said. "Because when America strays from our values, it not only undermines the rule of law, it alienates us from our allies, it energizes our adversaries and it endangers our national security and the lives of our troops."

In Annapolis, he addressed a crowd that included his rival from the 2008 election, Sen. John McCain.

The Arizona senator, his wife, Cindy, and mother, Roberta, stood and cheered as McCain's son, Jack, a member of the graduating class, received his degree and a hearty embrace from Obama, who spent nearly two hours shaking hands and exchanging a few words with every member of the graduating class.

Obama did not mention the McCains, out of respect for their wishes, according to a White House official. When another speaker did, near the close of the ceremony, the crowd responded with a warm round of applause.


Obama paid tribute to the graduating midshipmen and their willingness to serve at a time when U.S. forces are engaged in conflicts overseas.

"In an era when too few citizens answer the call to service - to community or country - these Americans chose to serve," said Obama, who did not serve in the military. "And they did so in a time of war, knowing they might be called upon to make the ultimate sacrifice."

Maryland Gov. Martin O'Malley introduced the president to the crowd, calling him someone who is "strongly supportive of the United States military and ... believes in giving you the tools and the support that you need to protect all of our families."

A giant TV screen, sponsored by defense contractor General Dynamics, beamed close-up views of the president and other speakers to the stadium crowd.

Obama received a wind breaker from the graduating class, complete with "pockets for your BlackBerry," said Ensign Andrew R. Poulin, the class president. "You'll look sharp on the basketball court with it, sir."

By tradition, the midshipmen stand to be sworn into one of the branches of the armed services, mainly the Navy and Marine Corps. Each is required to serve a minimum of four years on active duty; an academy spokesman said few would be sent immediately to Iraq or Afghanistan.


At the conclusion of the ceremony, the graduating class cheered the thousands of underclassmen they were leaving behind and tossed their caps into the air - a photogenic tradition dating back nearly a century - as cannons boomed.