The crew of HMS Chatham have marched through the Kent town for their farewell parade.
The ship's company were joined by the Band of the Royal Marines for the Freedom of the Borough parade.
The Strategic Defence and Security Review revealed the Royal Naval frigate would be withdrawn from service.
Councillor David Brake, the Mayor of Medway, said the parade "marked the final chapter" of the ship's long history with the town.
He added: "It is an honour and a privilege that HMS Chatham and her crew have decided to return for this farewell parade.
"The Royal Navy's connections with Chatham stretch back hundreds of years and I hope that as many people as possible will be out to give the ship's company a stirring farewell."
Cdr Simon Huntington said he was proud to have been granted the Freedom of the Borough by Medway Council.
"Although the day will be tinged with sadness, HMS Chatham has enjoyed more than 20 years of friendship and support from the local people.
"I'm certain that many happy memories of this special bond will remain long after the ship has gone."
The march set off at 1130 GMT from High Street and continued along The Brook and Dock Road.
Road closures were put in place to minimise disruption.
The council said Solomons Road, The Brook and Dock Road were affected.
During 20 years of service with the Royal Navy, HMS Chatham has been employed in anti-piracy, anti-narcotics and humanitarian operations.
It was present at the handover of sovereignty for Hong Kong in 1997 and carried out operations during the Sierra Leone civil war in 2000.
The Plymouth-based ship last visited Chatham Dockyard on Remembrance Day last year.