June 15 (UPI) -- After nearly four decades with NASA, including 22 years as an astronaut, Peggy Whitson is leaving the space agency. Her retirement is effective Friday, NASA announced.

"It's been the greatest honor to live out my lifelong dream of being a @NASA Astronaut," Whitson wrote on Twitter. "Thank you to the #NASAVillage and all who have supported me along the way. As I reminisce on my many treasured memories, it's safe to say my journey at NASA has been out of this world!"


Whitson ends her career with multiple records to her name, including most time spent in space by a U.S. astronaut -- 665 days. She has also conducted more spacewalks, 10, than any other female astronaut.

"Peggy Whitson is a testament to the American spirit," NASA Administrator Jim Bridenstine said in a news release. "Her determination, strength of mind, character, and dedication to science, exploration, and discovery are an inspiration to NASA and America. We owe her a great debt for her service and she will be missed. We thank her for her service to our agency and country."

The 57-year-old Whitson was a scientist before she was an astronaut, earning graduate degrees in biochemistry from Rice University in Houston before coming to conduct research at NASA's Johnson Space Center in 1989.

The NASA scientist began training as an astronaut in 1996. She made her first trip to the International Space Station in 2008.

During her time in space, including three long-duration stints aboard ISS, she helped carry out 21 science investigation and became the agency's first space station science officer. In 2008, Whitson served as commander of Expedition 16, the first female to do so.

RELATED NASA celebrates National Parks Week with park photos from space

Whitson took a second turn as commander during Expedition 51, part of her most recent -- and last -- stay on the space station, which spanned from November 2016 to September 2017.

Whether in space or back on Earth, Whitson's career was continually marked by firsts and superlatives. From, 2009 to 2012, she served as chief of the astronaut corps, becoming both the first female and the first non-military astronaut to hold the position.

"Peggy is a classmate and a friend, and she will be deeply missed," said Pat Forrester, current chief of corps. "Along with her record setting career, she leaves behind a legacy of her passion for space."