NASA canceled the launch of space shuttle Endeavour on Wednesday for the second time after a potentially dangerous hydrogen gas leak surfaced while the ship was being fueled for flight.

An identical problem stymied a launch attempt on Saturday. Technicians had replaced seals in a hydrogen vent line in hopes of stemming the leak.

The next opportunity to launch Endeavour will be on July 11.

We're going to step back and figure out what the problem is and go fix it, said deputy shuttle program manager LeRoy Cain. Obviously we have something here we didn't understand as well as we thought we may have.

Endeavour had been scheduled to lift off from the Kennedy Space Center in Florida at 5:40 a.m. EDT on Wednesday on a 16-day mission to install a Japanese-built porch on the International Space Station.

NASA had first hoped to launch Endeavour last Saturday but sensors detected dangerous levels of hydrogen gas escaping from a vent line and the launch was halted. A similar problem occurred during an attempt to launch sister ship Discovery in March.

The vent line removes hydrogen that has turned from liquid to gas inside the shuttle's fuel tank. The gas is funneled to a flare stack away from the shuttle and safely incinerated.

Since hydrogen is so volatile, the U.S. space agency has very tight safety restrictions on how much gas can be outside the shuttle.

With the shuttle launch delayed until July, NASA will turn its attention to the debut mission in its new exploration initiative aimed at returning astronauts to the moon by 2020.

The Lunar Reconnaissance Orbiter, due to launch as early as Thursday, is designed to spend a year scouting the moon's surface for prospective landing spots. The spacecraft includes a second satellite that will crash into a lunar crater to look for water.

Launching Endeavour before July 11 is not an option because the angle of the sun would overheat the shuttle while it was docked at the space station.

NASA is trying to finish building and outfitting the International Space Station by September 30, 2010, so it can retire the shuttle fleet and move on to developing a new spaceship that can carry astronauts to the moon and other destinations beyond low-Earth orbit.

Eight missions remain to complete the station, a $100 billion project of 16 nations that has been under construction 225 miles above Earth for more than a decade.

The seven-member Endeavour crew will install the Japanese porch, replace batteries on one of the station's solar wing panels and perform other maintenance tasks in the third of five flights planned for this year.

(Editing by Jim Loney and John O'Callaghan)