KINGS POINT, N.Y. — With his wife, former U.S. Rep. Gabrielle Giffords, watching and cheering nearby, retired astronaut Mark Kelly exhorted graduates at the U.S. Merchant Marine Academy to a life of public service, encouraging them Monday to persevere when faced with unexpected challenges.

Kelly, a 1986 graduate of the academy who later flew combat missions for the U.S. Navy during the Gulf War and then flew on four space shuttle flights, including as commander of the Endeavor's final mission in 2011, quoted from Winston Churchill, Ralph Waldo Emerson and several times from his wife during a 20-minute address to the 219 graduates.

Giffords, who was seated with other dignitaries near the side of the stage, didn't speak during the commencement but enthusiastically sang the National Anthem and waved to her husband as the ceremony started. U.S. Transportation Secretary Ray LaHood introduced the congresswoman to the graduates, their parents, friends and faculty, eliciting a standing ovation for the lawmaker who was shot in an assassination attempt that left six dead outside a Tucson shopping center 18 months ago.

Kelly also spoke of his wife's recovery and sought to use it as inspiration for the graduates.

"I have learned a thing or two about the power of the human spirit," he said. "It has been an incredible experience for me to watch my wife, Gabby, first fight so hard to survive and then fight so hard to come back. She has been an incredible inspiration to me. Each day as she heads off to therapy she'll often tell me, `fight, fight, fight.'"

"She reminds me each and every day to deny the acceptance of failure."

Kelly said when he left Kings Point in 1986, he dreamed of being the first human to walk on Mars. He said that when he first started pilot training he wasn't the best of aviators and confessed that Tom Cruise – the actor, not the character he played in the film "Top Gun" – would have made a better pilot back then. But he said perseverance and hard work paid off in a successful career.

"I started out as a lousy pilot and ended up commanding a rocket ship," he said. "I never made it to Mars, but the journey was certainly worth the effort. "

Kelly also encouraged the graduates to find some way to give back to society, a passion he said he and his wife share.

"It is vitally important that we all give something back. I encourage all of you to find some cause that you believe in, find yourself some role, either at a church, charity or service organization or maybe even seek elected office."

The academy, located on Long Island Sound, just outside New York City on the grounds of an estate once owned by automobile magnate Walter Chrysler, is operated by the Department of Transportation through its maritime administration. It trains graduates in a spectrum of disciplines to support the maritime industry.

As with the better-known U.S. military academies, midshipmen are nominated by their local members of Congress. Kings Point graduates, who receive bachelor's degrees, must serve five years on active-duty in the military or work in the maritime industry for five years, as well as eight years in the reserves, said academy spokeswoman Marcie Katcher. This year, graduates came from 37 states and four other countries.

Here is a playlist for Giffords' recovery:
Loading Slideshow...
  • Open Your Eyes (Snow Patrol)

    <a href="http://www.huffingtonpost.com/2011/01/12/obama-gabrielle-giffords-opens-eyes_n_808346.html" target="_hplink"><strong>(Jan. 8, 2011) --</strong></a> Four days after <a href="http://www.huffingtonpost.com/2011/01/08/gabrielle-giffords-shot-c_n_806211.html" target="_hplink">Rep. Gabrielle Giffords (D-Ariz.)</a> was wounded in a grisly shooting, President Barack Obama informed memorial service members that she opened her eyes for the first time. "I can tell you this," Obama said. "She knows we're here and she knows we love her and she knows that we will be rooting for her throughout what will be a difficult journey." (AP Photo/Chris Carlson)

  • Stand (Rascal Flatts)

    <strong><a href="http://www.huffingtonpost.com/2011/01/19/gabrielle-giffords-stands-on-two-feet_n_811355.html" target="_hplink">(Jan. 19, 2011) --</a></strong> Outside the University of Arizona's Medical Center, a decorated paper plate offered well wishes for the Tucson shooting victims. With assistance from doctors, Giffords stood on her own two feet for the first time since the incident. The congresswoman was soon transferred to TIRR Memorial Hermann Rehabilitation Hospital in Houston, one of the top-rated rehab facilities in the country. (AP Photo/Susan Montoya Bryan)

  • Stand By Me (Ben E. King)

    <strong><a href="http://www.huffingtonpost.com/2011/05/16/gabrielle-giffords-shuttle-launch_n_862400.html" target="_hplink">(May 16, 2011) --</a></strong> In this Feb. 2011 file photo, Giffords' husband Mark Kelly held a wrist band decorated with a peace sign, heart and the word 'Gabby'. By mid-May, Giffords was watching Kelly fly off into space on NASA's Endeavour expedition. The couple exchanged their wedding rings before takeoff. (Photo by Eric Kayne/Getty Images)

  • Fighter (Christina Aguilera)

    <a href="http://www.huffingtonpost.com/2011/06/28/gabrielle-giffords-public-appearance_n_885772.html" target="_hplink"><strong>(June 28, 2011) --</strong></a> Giffords made her first public appearance since being wounded in the Jan. 2011 shooting, attending a ceremony at Texas' Space Center Houston with Kelly. She received a standing ovation from the crowd. (AP Photo/southwestphotobank.com, P.K. Weis)

  • You're The Inspiration (Chicago)

    <a href="http://www.huffingtonpost.com/2011/08/01/gabrielle-giffords-debt-ceiling-vote_n_915569.html" target="_hplink"><strong>(Aug. 1, 2011) --</strong></a> Giffords completed her first House floor appearance since the shooting, attending a vote on the debt ceiling. "The reaction in the chamber was the most enthusiastic, exuberant, exhilarating -- I mean we were all crying -- thrilled -- you know, we just knew she would make a triumphant return," Rep. Debbie Wasserman Schultz (D-Fla.) said. (AP Photo/House Television)

  • Don't Stop (Fleetwood Mac)

    <a href="http://www.huffingtonpost.com/2011/08/30/gabrielle-giffords-walking-writing_n_941894.html" target="_hplink"><strong>(Aug. 30, 2011) --</strong></a> Via a Giffords spokesperson, the Associated Press learned that less than eight months after being wounded, the congresswoman was walking and writing on her own. (Photo by P.K. Weis/Giffords Campaign via Getty Images)

  • I Didn't Know My Own Strength (Whitney Houston)

    <a href="http://www.huffingtonpost.com/2011/11/10/gabrielle-giffords-tv-interview_n_1087420.html" target="_hplink"><strong>(Nov. 10, 2011) --</strong></a> Giffords' first TV interview since the shooting went to ABC News. The congresswoman answered questions with a clear voice, telling host Diane Sawyer that she felt "pretty good." Giffords added that the recovery had been "difficult."

  • It's So Hard To Say Goodbye To Yesterday (Boyz II Men)

    <a href="http://www.huffingtonpost.com/2012/01/22/gabrielle-giffords-stepping-down_n_1222168.html" target="_hplink"><strong>(Jan. 22, 2012) --</strong></a> A little more than a year after the shooting, Giffords announced that she was leaving Congress. In a Facebook video, she cited her recovery as a primary concern, thanking her constituents for their support: "I don't remember much from that horrible day, but I will never forget the trust you placed in me to be your voice," Giffords said. (AP Photo/Office of Gabrielle Giffords)

  • I Can See Clearly Now (Johnny Nash)

    <a href="http://www.huffingtonpost.com/2012/01/24/gabrielle-giffords-last-bill_n_1229309.html" target="_hplink"><strong>(Jan. 24, 2012) --</strong></a> Two days before exiting Congress, Giffords unveiled her final bill, aimed at stopping cross-border drug smugglers. "Congresswoman Giffords is committed to taking this crucial step that would help secure the border against drug smugglers," Giffords' chief of staff, Pia Carusone, said in a statement. "That's why she decided this would be the last bill she introduces before she steps down." (Photo by Jonathan Gibby/Getty Images)

  • Hero (Mariah Carey)

    <a href="http://www.huffingtonpost.com/2012/01/25/gabrielle-giffords-state-of-the-union-appearance_n_1230480.html" target="_hplink"><strong>(Jan. 24, 2012) --</strong></a> Giffords made a moving appearance at Obama's 2012 State of the Union address. Her presence drew rousing applause, inspiring colleagues on both sides of the aisle. (Photo by Saul Loeb-Pool/Getty Images)