Media playback is unsupported on your device Media caption Hillary Clinton: "I am so grateful that we've had a chance to contribute to making the world safer"

Hillary Clinton has said the world is a safer place, in her farewell address to state department staff on her last day as America's top diplomat.

Mrs Clinton, 65, leaves the post after four years, visits to 112 countries and nearly a million air miles.

She will be replaced by John Kerry, a Massachusetts senator, who was sworn in at a private ceremony on Friday.

The former first lady is now discussed as a possible candidate for the 2016 presidential election.

Mrs Clinton said leading the agency as the 67th US Secretary of State had been a "unique and singular, exciting and challenging" experience.

'More optimistic'

She acknowledged the attack on the US embassy in Turkey - a sobering reminder of the everyday global threats that will face her successor.

Ambassador for America Hillary Clinton visited 112 countries in four years, making her the most-travelled secretary of state

Foreign Policy magazine's Secretary of Schlep slideshow has 112 photos, one from each country (registration required)

"Her total time spent travelling adds up to 2084.21 hours (or 86.8 days), and she will have racked up 956,733 miles," it notes Hillary Clinton's long journey

"I am very proud of the work we have done together," she told her staff. "Of course, we live in very complex and dangerous times, as we saw again just today at our embassy in Ankara, where we were attacked."

But she said she was "more optimistic" now than when she took up her post in 2009.

"I am so grateful that we've had a chance to contribute in each of our ways to making our country and our world stronger, safer, fairer and better," she told staff.

Earlier in the day, Mrs Clinton officially tendered her resignation to President Barack Obama, her former bitter rival in the 2008 race for the Democratic presidential nomination.

In her letter, she said she was more convinced than ever of America's strength as a global leader and its potential to be a force for good.

Mrs Clinton has been coy about a possible White House run in four years' time. She has said she has no specific plans for the future, but that she "absolutely" still plans to make a difference on issues she cares about.

"I am going to be secretary of state until the very last minute when I walk out the door," she told the Associated Press on Thursday.

"And then I am going to take the weekend off and then I may start thinking about all the various offers and requests and ideas that have come my way."

Mrs Clinton's time in office will also be remembered for the attack last September on a consulate in Benghazi, Libya, that killed a US ambassador and three other Americans. She has apologised for that security failure.