He was on the Discovery mission in October 2000 to expand the International Space Station (ISS). During the mission he carried out two space walks totalling more than 14 hours. Lopez-Alegria flew on the Endeavour to the ISS from 23 November to 7 December 2002, exchanging resident crews, and he made three space walks of nearly 20 hours to install the P1 Truss. He also commanded ISS Expedition 12 in April 2007, for a seven-month mission, in which he performed three space walks totalling nearly 20 hours. Lopez-Alegria was selected as an astronaut in 1992 and retired from NASA in March 2012. During his career, he has logged more than 257 days in space and performed 10 space walks totalling 67 hours and 40 minutes of EVA.