I was wandering the Australian city’s historic waterfront district, known as the Rocks, down one of the original lanes hand-hewn by forced convict labor from honey-colored sandstone. But it was hard to imagine brutalized chain gangs pounding boulders when all I saw were outdoor restaurants with crowds of tanned Aussies working their way through mounds of fresh oysters and lunchtime bottles of “sav-blanc.”

The sky was a lurid blue, and a eucalyptus-scented breeze drifted in the air. Why exactly was I thinking of convict floggings with the cat-o’-nine-tails and corpses on the gibbet? It seemed downright masochistic.

Today, Sydney sits comfortably near the top of surveys ranking the world’s most livable cities. Its white-sand beaches and sparkling harbor still deliver the Pacific idyll, evoking California in the ’60s. In iconic locales such as Bondi Beach you can step from the surf into glamorous bars and chic oceanfront restaurants with dazzling Asian-fusion menus.

It’s quite a turnaround for a city that was founded in 1788 as a dumping ground for the riffraff of Britain. Back then, in a wildly ambitious social experiment, about 750 petty criminals from the slums of Britain y were shipped with some 250 marine guards in what has famously come to be known as the “First Fleet” — an eight-month journey to a barely explored fringe of the world. The result, as Robert Hughes wrote in “The Fatal Shore,” was the first gulag, where nature itself provided the prison.

Showcasing the convict past

First-time visitors to Sydney might be forgiven for assuming that little of this history survives, since the city center has been reshaped over the last 200 years. Growing up in the Sydney suburbs in the 1970s, I had much the same idea myself. To me, the most tangible piece of the country’s cruel history was a family heirloom, an iron ball and chain.

Today, Sydney is making a greater effort to showcase the evocative ruins and relics. Last summer, 11 Australian convict sites, including ruined prisons, a former governor’s house and a highway, were awarded UNESCO World Heritage status.

Four of them are in and around Sydney, where they are joined by a handful of other ruins from the time. They are almost all found in glorious natural settings, so on a recent visit, I decided to concentrate on those bleak prison years and try to visualize the city that existed long before anyone was throwing shrimps on the barbie. (Actually, Aussies call them prawns, but that’s another matter.)

The trail led me from famous sites in the heart of the city to others that are remote and little known. Admittedly, it can take a little legwork. For example, only a small plaque marks the actual place where the 1788 landing — and scenes of drunken revelry — occurred, just west of the modern ferry terminal of Circular Quay. The shoreline one sees today has been extended by about 100 yards over the last two centuries. But getting a sense of how the harbor might have looked when the First Fleet arrived is surprisingly easy, as sections of the shoreline have been preserved as national parkland.

I set off to the northern side of the Harbor, where a six-mile hike follows the shore from the Spit Bridge (connecting the suburbs of Mosman and Seaforth) to the ocean beach at Manly. Just a 25-minute taxi ride from the Opera House in Sydney’s central business district, the trail climbs high onto a series of sandstone headlands then down to pristine beaches framed by red-gum forest.

At Castle Rock Beach, a sliver of sand about an hour into the trail, I could gaze in any direction and see nary a speck of civilization — if you exclude the occasional sailboat, that is.

It was easy to imagine the convicts, mostly petty thieves from British slums, gaping in confusion at the strange foliage while Eora Aboriginals presciently yelled “Werre! Werre!” — Go away!

The Eora had thrived for some 40,000 years on the land’s natural bounty, hunting kangaroo, eating native plants and fishing, while the British arrivals nearly starved as they tried in vain to raise imported crops like potatoes.

Harbor islands

As I returned to the bright lights of central Sydney, it didn’t take long to realize that even the most ghoulish historical settings now offer shamefully pleasant dining opportunities. One day I took a privately run ferry service to Fort Denison, a barren fortress on a speck of rock in the middle of the city’s harbor.

Once known as Pinchgut, it was synonymous with abject hunger to the convicts because those who committed minor offenses could be deposited there in chains and on pitiful rations. Its reputation worsened in 1796, when a convict named Francis Morgan was hanged there. His suspended remains were left to rot on the scaffold as a macabre warning to new arrivals.

From 1841, the island was remodeled into a colonial fort.

Today, because of its postcard-perfect views of the Opera House and Harbour Bridge, it is home to the Fort Denison Cafe, protected from the wind by clear plastic.

As I nibbled my tempura fish and chips, this site of past torment provided beautiful views of other historic horror spots, including a distant glimpse of Goat Island, where in 1835, as the story goes, a convict named Boney Anderson, having already received some 1,200 lashes, was chained naked to a rock for two years. It became an afternoon’s amusement for rougher settlers to row out to the island and throw scraps of meat to the prisoner.

There are actually a dozen small islands in the harbor, all with convict connections, and visitors can stay overnight on what was once the most dreaded — Cockatoo Island. A 14-acre outcrop surrounded by deep, shark-infested waters, it became from 1839 the Alcatraz of Australia, a prison within the prison for repeat offenders.

Up to 500 prisoners were squeezed into the airless barracks every night, often three to a bunk, and at night they could be seen gasping at the iron gratings for fresh air. The prison was closed in 1869, after which it became the largest shipyard in the Southern Hemisphere in the early 20th century.

Uninhabited since 1992, the island has slowly been turned into an outdoor industrial museum featuring gargantuan warehouses, tunnels and cranes; outsize art installations are often created in the majestic spaces.

Recently, camping has been allowed on the island, and a few historical residences, built for on-site administrators of the dockyard, have been offered for rent. In-the-know Sydney residents go there for a relaxing getaway within the heart of the city.

A must-see convict museum

Back in the busy heart of the city lies a must-see attraction for all convict aficionados: Hyde Park Barracks, whose harmonious design was the work of a rehabilitated felon, Francis Greenway. (He’s the only convicted forger ever to be honored on a bank note, Australia’s old $10 bill.)

Built in 1819 to house male convicts, the structure later became an orphanage and courthouse. Each phase of its existence left a layer of debris that has been a gold mine for archaeologists.

Today, the orange-brick edifice contains a museum with a permanent collection of cat-o’-nine-tails and leg irons — and an elegant cafe across the courtyard.

When I visited, a curator, Jenny White, retrieved from the archival vault the only mint-condition convict uniform ever found in Sydney.

A rough calico tunic with thin blue stripes, it was found beneath the floorboards by a plumber during 1979 renovations. Apparently he was so excited that he put on the uniform and ran around the construction site pretending to be an inmate.

A convict road

But the convict system left its most impressive remains in the rural area northwest of Sydney — the Great North Road. It was built entirely by the so-called Iron Gangs — groups of serial offenders, who were forced to sleep in cramped bark huts and survive on starvation rations while digging a 162-mile-long highway.

The whole thing took from 1826 to 1836 to complete; it is unknown how many convicts died in the process.

Today, a 5-mile stretch is still intact and has been preserved as a park about 90 minutes drive from the city center, providing a unique historic walking trail through gorgeous Australian bush.

Riddled with sandstone bluffs, the landscape today is still rugged and spectacular, although it can feel a tad like Aussie “Deliverance” country.

I was alone on the road, which offered splendid views of the Hawkesbury River and pristine bush. It felt as if the convicts had just left yesterday.