(CNN) -- The space shuttle Atlantis crew on Monday afternoon completed its final spacewalk to upgrade the Hubble Space Telescope, according to NASA.
The Hubble Space Telescope hangs above Earth in a 1997 photo taken from the shuttle Discovery.
The spacewalk was said to be the last time human hands would touch the orbiting telescope, which provides astronomers distant images to help them see further into the origins of the universe.
The telescope should be able to operate from these upgrades for five to 10 years, at which time Hubble will either remain in orbit or will be pushed through the atmosphere and plunged into the ocean by a robotic spacecraft, said J.D. Harrington, a NASA spokesman.
"After today's spacewalk, we'll have a brand new telescope that's better than it ever has been," Harrington said.
Another orbiting telescope will replace Hubble in 2014, he said.
The Hubble has been in orbit for 19 years. It can capture images that telescopes on Earth can't, partly because it doesn't have to gaze through the planet's murky atmosphere. View a slideshow of galaxy images captured by Hubble
The famous telescope caused controversy early in its career when a small fault in one of its mirrors caused its images of space to be blurred. Astronauts repaired the fault in the mirror in 1993.
During the current mission, astronauts conducted long spacewalks to do routine repairs to the telescope.
On Monday, the team replaced the telescope's batteries and put thermal blankets over some of its electronics, to protect them from extreme temperatures in space, NASA said.
The final spacewalk began about 8:15 a.m. ET on Monday and finished about seven hours later, at 3:20 p.m., according to NASA.
Mechanical hang-ups slowed several of the five spacewalks during this mission, Harrington said. On Sunday, astronauts had trouble unbolting a panel that covered circuit boards that needed to be replaced. The spacewalkers eventually had to break off a handle on the panel to get inside, he said.
Some of Sunday's work was pushed back to Monday, which could cause delays, he said.
The NASA crew is scheduled to release Hubble into orbit again Tuesday before 9 a.m. ET, and the shuttle is expected to land back on Earth on Thursday, he said.
Monday's spacewalk was the last of five scheduled during the 11-day mission in which the crew is working in the shuttle's cargo bay to upgrade and repair Hubble. Learn more about the Hubble repairs »
The mission is one of the most ambitious space repair efforts ever attempted.
After a two-day chase, the shuttle captured the telescope Wednesday with its robotic arm some 350 miles (563 kilometers) above Earth and pulled it into Atlantis' cargo bay for service. Watch Atlantis snag the Hubble »
It's been seven years since the last space shuttle crew worked on the telescope, which has been latched to a rotating, "lazy Susan"-type device for the five days of repairs and remodeling.
A camera mounted on the shuttle's robotic arm, 200 feet (61 meters) from the telescope, is taking pictures of it -- the first time the telescope has been photographed seen since March 2002.
An umbilical line was connected to provide electricity from Atlantis to the telescope, according to NASA. Mission Commander Scott Altman also will position the shuttle to allow Hubble's solar arrays to gather energy from the sun and recharge the telescope's batteries.
The timeline for the spacewalks is so tight, there's a chance the astronauts won't get everything done, especially if they hit any snags. And that's a real possibility because some of the repairs they are attempting have never been tried before.
NASA canceled an Atlantis mission to extend Hubble's operational life in January 2004 because the trip was considered too risky after the 2003 space shuttle Columbia disaster, which killed seven astronauts.
That accident was blamed on a hole punched in the front of the wing by debris during liftoff. But public pressure and steps taken to increase shuttle safety led the space agency to reconsider.
Hubble's "greatest discoveries," NASA says, include determining the age of the universe -- 13.7 billion years; discovering that "virtually all major galaxies have black holes at their center"; and "providing evidence that the speed at which the universe is expanding is accelerating -- caused by an unknown force that makes up more than 75 percent of the universe."
CNN's John D. Sutter, John Zarrella and Kim Segal contributed to this report.