Astronauts on the shuttle Discovery have undocked their craft from the International Space Station, in the first step towards returning home.
Nasa earlier declared the shuttle safe, clearing the way for the first step to Discovery's planned landing on Monday.
After saying goodbye to the station's two residents, the crew slowly undocked and fired the shuttle's jets to reposition it ready for re-entry.
It is Nasa's first shuttle mission since the Columbia disaster in 2003.
The Discovery crew parted from the Russian and American astronauts who hosted their nine-day stay on the International Space Station (ISS) with hugs and handshakes.
"We are so happy to have spent time up here," Discovery commander Eileen Collins said. "These are memories that we will have forever."
"We would love to have you stay a little longer... Have a good flight and soft landing," station astronaut John Phillips replied.
After unhitching, the shuttle orbited the space station to take photographs from all angles and check for damage.
Discovery's visit to the ISS may be the last shuttle mission for some time.
Nasa has grounded the fleet until it fixes the flying debris problem, which destroyed Columbia and resurfaced at Discovery's launch on 26 July.
Because of safety measures put in place after Columbia broke apart on re-entry to Earth's atmosphere, Discovery has been videotaped, photographed and laser-inspected.
In a shuttle program first, it has also been repaired by Steve Robinson and Japanese crew member Soichi Noguchi during one of their three spacewalks.
The men removed two loose cloth strips, which were protruding from the shuttle's belly.
US space agency officials debated whether to send the astronauts on a second spacewalk to fix a small tear in an insulating cloth protecting the surface of Discovery near the commander's window.
Nasa experts feared the cloth could come off during descent into the atmosphere and seriously damage the 100-tonne shuttle.
'In good shape'
But deputy shuttle program manager Wayne Hale said on Thursday that Discovery was sturdy enough to withstand the heat of re-entry.
"We've assessed this risk to the very best of our engineering knowledge and we believe the vehicle is safe to fly and for re-entry," he said.
Paul Hill, lead shuttle flight director, also stressed that Nasa is confident of a safe return for Discovery.
"We are in really good shape," he said. "The vehicle is in pristine condition. All the tests are good, we are ready to go. But de-orbit is not a risk free activity. Our big risk now would be the weather."
The shuttle is expected to land early on Monday morning at Kennedy Space Center near Cape Canaveral. The touchdown time, weather permitting, has been set for 0446 EDT (0946 BST; 0846 GMT).