The fortified walls and moat that surround the old city of Thanjavur are remnants of successive military engineering — begun under the Nayaka governors, reinforced by the Maratha rulers, and partially modified under British administration. The most intact stretches of the fort wall run along the western and southern sides of the old town, enclosing the Brihadisvara Temple and the Royal Palace within the same fortified precinct.
Walking along the outer edge of the old city, you can follow sections of the original moat — now partly silted and in places converted into roads — and see how the defensive geography shaped the city's layout. The fort gates (gopurams of a different kind) are mostly absorbed into the surrounding urban fabric, but several arched gateways survive in reasonable condition. The fortification is not prominently signed or managed as a tourist site, which means you have it largely to yourself; it works well as a framework walk around the historic core.