© ReutersFile handout image of U.S. Representative Gabrielle Giffords is pictured with her husband NASA Astronaut Mark Kelly in this November 2007 photograph from their wedding
Captain Mark Kelly, the astronaut who commanded the final Space Shuttle Endeavour flight, will retire from the Navy and NASA to focus on his wife Congresswoman Gabrielle Giffords' recovery and work on a memoir with her.

"I want to be by her side. Stepping aside from my work in the Navy and at NASA will allow me to be with her and with my two daughters," Kelly said in a statement posted to his Facebook page on Tuesday.

Giffords is recovering after being shot through the head at a Congressional outreach event in Tucson on January 8.

The as-yet untitled memoir will be published by Scribner, an imprint of Simon & Schuster, which said in a statement it will be a "deeply personal account" of the couple's courtship, Giffords' career in politics and the shooting.

It also will tell the story of her recovery process and trace Kelly's career from decorated Desert Storm combat pilot to his recent mission as shuttle commander, the statement said.

Jeffrey Zaslow, an author and Wall Street Journal columnist, will collaborate on the book, Scribner said.

Zaslow co-wrote Highest Duty by pilot Chesley "Sully" Sullenberger, who safely landed a US Airways jet in the Hudson River in January 2009.

A publication date for the memoir has not been set. Scribner said a portion of the net proceeds will go to charity in Tucson and Arizona.

"Gabby and I are forever grateful for the heartfelt support we've received over these many months. We are looking forward to sharing our story," said Kelly in the Scribner statement.

Kelly said he would retire on October 1. He said he hoped to serve the country again in the future.