Image copyright AFP/Getty Images Image caption Gene Cernan was the commander of the Apollo 17 mission in December 1972

US astronaut Gene Cernan - the last man to walk on the Moon - has died aged 82.

America's space agency Nasa said it was "saddened by the loss" of the retired spaceman.

Captain Cernan was one of only three people to go to the Moon twice and the last man to leave a footprint on the lunar surface in 1972.

The final words he spoke there were: "We leave as we came and, God willing, as we shall return with peace and hope for all mankind."

He was the commander of the Apollo 17 mission at the time.

Twelve people have walked on the Moon, and only six of them are still alive today.

Image copyright NASA via Reuters Image caption Cernan travelled into space three times

Apollo 17: Pictures, video, facts

Mark Craig, director of Last Man on the Moon, reflects on Gene Cernan's passing

In a statement, Cernan's family said he passed away on Monday following ongoing health issues. They did not give any further details.

"It is with very deep sadness that we share the loss of our beloved husband and father," the statement said.

"Our family is heartbroken.

"Even at the age of 82, Gene was passionate about sharing his desire to see the continued human exploration of space and encouraged our nation's leaders and young people to not let him remain the last man to walk on the Moon."

Image copyright EPA Image caption Cernan retired in 1976, going into private business and contributing to US television channels

Before the Apollo 17 mission, Cernan had travelled into space twice - in 1966 and 1969.

A qualified naval aviator, he was selected into the third group of Nasa astronauts in 1963.

He retired in 1976, going into private business and contributing to US television channels on a variety of issues.

Cernan also produced a documentary film about his life, which he discussed at length in this BBC interview in 2014.

Born on 14 March 1934 in Chicago, his full name was Eugene Andrew Cernan.

He is survived by his wife Jan Nanna Cernan, his daughter and two step-daughters and also nine grandchildren.

His family said details regarding his funeral would be announced in the coming days.

Gene Cernan's death comes just weeks after that of another Nasa astronaut, John Glenn.