Three weeks after his wife, Rep. Gabrielle Giffords (D-Ariz.), was gravely injured in a mass shooting, astronaut Mark E. Kelly knew he was ready to command a space shuttle mission planned for April, he said Friday.

But his managers needed reassurance. So for the past week, they tested Kelly's ability to focus on the complicated mission while he spent extended time away from his wife for the first time since the shooting.

First, Kelly piloted a T-38 trainer jet, demonstrating that his basic flying skills had not waned. Then he spent four hours in a shuttle simulator with his mission's crew, practicing multiple launches and landings while operators threw malfunctions and other challenges Kelly's way. The 24-year veteran of the Navy and NASA made no mistakes.

Kelly said at a NASA news conference that his training allows him to "compartmentalize" and set aside personal worries in the face of risky missions.

"You learn to ignore stuff in your personal life," he said. "You learn to separate the mission from things that might be going on in your personal life."

Kelly did allow that he will have to work harder than usual to focus on the mission.

"This time, it might be a little more challenging to do that," he said.

When Endeavour lifts off April 19 on what is expected to be the craft's last mission, Kelly will assume responsibility for the lives of himself and five other crew members during a 14-day, multibillion-dollar mission to re-supply the international space station and deliver an astrophysics experiment. Kelly's twin, Scott, now commands the station but will be back on Earth a month before his brother lifts off.

"Mark had a very good plan" for resuming training after a month away, said Brent Jett, NASA's chief of flight crew operations. "He had a routine he explained to me, how his days would proceed, how he would commit time to the mission."

But one piece was missing, Jett said: whether the three-time space veteran could concentrate on overseeing a complicated flight plan while Giffords remained hospitalized.

"It was important for us to know he'd be able to focus while in training and not be distracted by Gabrielle's situation up at the hospital," Jett said.

Shuttle commanders undergo intensive training that ingrains laserlike focus in the face of split-second, life-and-death choices, said John Logsdon, a space policy expert at George Washington University.

"The commander really is a commander," Logsdon said. "He is the one who has to make almost instantaneous decisions."

Wearing a blue wristband reading, "Peace, Love, Gabby," and citing the "remarkable progress" of his wife, Kelly said the decision was unanimous, with Giffords's family and Kelly's managers at NASA all offering unwavering support.

"We had a discussion," Kelly said when asked whether Giffords supported his return to flight training. Kelly declined to provide details on his wife's condition but said, "I know her very well. She would be very comfortable with the decision I made."

In the days after the attack in Tucson in which six people were killed and Giffords was shot through the head, Kelly planned to give up his seat on Endeavour, he said, as her doctors expected a lengthy stay in the intensive care unit.

Instead, after 12 days, Giffords had improved enough to move to TIRR Memorial Hermann Hospital in Houston, near the Johnson Space Center where Kelly will resume training.

"Since then, she's made progress every day," Kelly said.

That improvement pushed Kelly toward taking the commander's chair as planned. Giffords's busy rehabilitation schedule and the support she continues to receive from her family and friends buttressed the decision, Kelly said.

Kelly's decision to return to space comes as Giffords continues her rigorous therapy. Pia Carusone, Giffords's chief of staff, said Giffords spends up to six hours a day with her therapists. A tracheal tube that has made it difficult to determine her ability to speak is scheduled to be removed soon.

Friends and family typically are not present during rehabilitation sessions, Carusone said, because Giffords has to remain focused.

A constant stream of visitors at the hospital has decorated Giffords's room with flowers, family pictures and drawings sent in from Arizona elementary schools. Kelly spends some nights there, and so do her parents, Spencer and Gloria Giffords.

The congresswoman has not spent a night alone since arriving, Carusone said.

"It's not like it's a heavy, solemn mood there," she said. "There's a lot of reason to be very hopeful. There's oftentimes a lot of laughter coming out of the room, especially if her dad's in the room."

Prosecutors in Arizona announced Friday that Jared Lee Loughner, identified by authorities as the gunman, will not face state charges until his federal trial is completed. He has so far been indicted on three charges of attempted murder in the wounding of Giffords and two of her aides. More federal charges are expected to follow.

While in orbit, Kelly will stay in touch with his family and Giffords's via e-mail, an Internet phone, and a single videoconference near the end of the mission. During final preparations and while in orbit, Kelly will turn the responsibility for all decisions about Giffords's care to her mother, he said.

After a reporter asked Peggy Whitson, chief of NASA's astronaut office, how the agency would respond if Kelly wavered between now and April, Kelly leaned over to Whitson and whispered something.

"Mark just said he's not going to change his mind," Whitson said.

When Kelly takes his seat on Endeavour, he expects to do so knowing his wife's eyes - and perhaps the eyes of a nation that has largely lost interest in the waning shuttle program - are on him.

"There really shouldn't be any reason she can't go to the launch," he said.