President Barack Obama and first lady Michelle Obama join Michigan State coach Tom Izzo, right, the men’s basketball team as they watch a flyover
President Barack Obama and first lady Michelle Obama join Michigan State coach Tom Izzo, right, the men's basketball team as they watch a flyover from the flight deck of the USS Carl Vinson before the Carrier Classic NCAA basketball game between Michigan State and North Carolina, Nov. 11, 2011, in Coronado, Calif. (Charles Dharapak/AP)

CORONADO, Calif. - Soaking in one of the most spectacular settings of his time in office, President Barack Obama pledged an unwavering commitment to veterans Friday from the deck of an aircraft carrier doubling, for one night, as a gleaming basketball court.

The president's patriotic message to the military crowd, while welcomed, was secondary to the scene itself. The players from two storied basketball programs, No. 1 North Carolina and Michigan State, competed aboard the USS Carl Vinson in the open air, in the dusk of a perfect San Diego evening.

Basketball star power was on hand in the form of Magic Johnson and James Worthy, former teammates on the Los Angeles Lakers and alums of Michigan State and North Carolina, respectively.

The first-ever Carrier Classic gave Obama a chance to honor troops and pay tribute on the 95,000-ton Navy warship that buried Osama bin Laden's body at sea. For the hoops-loving president, topping it all off with a college basketball game played outside and on water was surely unforgettable.

There were about 7,000 people in the crowd, both teams wore camouflage versions of their regular uniforms and two fighter jets screamed right above the carrier anchored off the coast of San Diego just as the singing of the national anthem was reaching its final notes.

"Every American citizen can make a solemn pledge today that they will find some opportunity to provide support to our troops, to those who are still active duty, to our national guard, to our reservists and to our veterans," Obama told the crowd before the game got under way.

"It's especially appropriate that we do it here," Obama said, referencing the carrier's role in "that critical mission to bring Osama bin Laden to justice."

A day after the Senate acted in unusual bipartisan agreement to pass a small piece of the president's jobs bill aimed at helping veterans, Obama said that to support veterans was "a sacred trust."

"That gratitude we have for the men and women in the armed forces does not stop when they take off the uniform," he said.

Once the game started Obama, wearing a bomber jacket, watched from the sidelines, looking thrilled, as Michelle Obama looked on at his side.

Despite the unusual setting, it quickly turned into a real basketball environment.

"Can we get a call, ref?" one sailor shouted.

"Get your head in the game!" said another.

The court was surrounded by stands of fans, so no loose balls had a chance of splashing in the water.

Obama's stop in San Diego was the first leg of a nine-day diplomacy mission he's embarking on, to Hawaii, where the U.S. is hosting an economic summit for the Asia-Pacific, and from there to Australia and Indonesia. He is aiming to use the trip to create bonds and boost U.S. business in the region before arriving back in Washington Nov. 20.