Everything seemed set for a magic moment. The wounded congresswoman was in town. The president was on his way. The space shuttle’s huge external tank was fueled.

But moments before Commander Mark E. Kelly was about to board Endeavour on Friday, NASA officials scrubbed a launch that had drawn hundreds of thousands of people to America’s “Space Coast.” The cancellation — caused by a possible faulty auxiliary power unit heater — deprived injured Rep. Gabrielle Giffords, (D-Ariz.), of a chance to watch her husband command Endeavour on its final mission and the penultimate launch of the U.S. space shuttle program.

NASA Launch Director Michael Leinbach says the shuttle crew may give it another try as soon as Monday afternoon, though it’s not uncommon for delays to last much longer.

Giffords’ presence had lent an emotional grace note to preparations for Endeavour’s launch and even overshadowed the planned visit of President Obama and the first family — the first time a sitting president was to attend a shuttle launch since Bill Clinton in 1998. Giffords flew in two days earlier from Houston, where she has delighted doctors with the pace of her recovery after being shot in the head and nearly killed Jan. 8 in Tucson, Ariz. Grainy footage of Giffords climbing the stairs of her plane with only minimal help captivated viewers, and heartened fellow victims of the shooting, which left six dead and 12 others wounded.  

“She is a miracle now,” Mavy Stoddard, who lost her husband and suffered three bullet wounds in the shooting, said in an interview from her Tucson home. “And miracles do happen.”

Though Giffords made no public appearance, the emotions of the day could be tracked on her Twitter feed. In the morning, a Tweet read: “Msg from Mark: It’s 8:15 am. We get on the clock at 10:30 am for a 3:47 pm launch. Weather looking pretty good.” Later, the message was “Staff: Bummed about the scrub!! But important to make sure everything on shuttle is working properly.”

President Obama and the first family went ahead with their planned visit, after surveying tornado damage in Alabama. The president visited with Giffords for 10 minutes, according to a White House official who spoke on condition of anonymity. Before going in to see her, the president greeted her husband in a corridor. “I bet you were hoping to see a rocket launch today,” Kelly said. “ We were hoping to see you,” the president responded. They shook hands and embraced.

Leinbach said Endeavour was grounded because NASA detected a problem with either the heater for one of the shuttle’s three auxiliary power units, or the thermostat. The power units keep the hydraulic system from freezing during orbit. They’ll also look into possible problems with the shuttle’s “load” control assembly, a complex piece of equipment that could force a long delay. “ We will not fly this machine until it’s ready.’’ Leinbach said.

Shuttle delays have been caused by everything from inclement weather to woodpeckers pounding holes in fuel-tank insulation. Only about 40 percent of shuttle missions launch on schedule, said Paul Fischbeck, a professor of engineering and public policy at Carnegie Mellon University, who analyzed NASA data. The odds improve only slightly to 50 percent on second attempts.

Investigations after the 1986 Challenger explosion and the 2003 Columbia crash — which cost the lives of 14 astronauts — pointed to scheduling pressure as a contributing factor in both disasters, said Scott Pace, director of the Space Policy Institute at George Washington University. In response, Pace said, NASA now trains its crews to avoid “launch fever.”

It was something more like the fever of love that drove Chris Cardinal — an Arizona Web designer who joined a NASA Tweet Up at the Kennedy Space Center — to stand before the countdown clock and pull a ring from his pocket at T-minus 4 hours, 10 minutes and 9 seconds. His girlfriend, Nina Tillman — a self-described “space nerd” — accepted his proposal and, apparently, it wasn’t just the heat of the pre-launch moment. After the scrubbing, Cardinal said, “she didn’t throw the ring back and blame the launch delay on me.”

Staff writer Brian Vastag reported from Washington.