Two ports flank Taipei and both played a role in forging what is now the Republic of China.

To the west, Tamsui stands alongside a well-sheltered and thus strategic harbour and has become something of a suburb of the capital, connected by the metro.

I find my guide, Mathias Daccord, who recently moved from Shanghai in search of a “less toxic” life, at Tamsui station, sporting a pair of aviators and designer stubble circa 1985. With an assuring wink he hands me a helmet, then races us through town, exhibiting the reverence for safety one might expect from a Parisian on a scooter in East Asia.

We pass churches and temples, new apartment blocks and heavily weathered tenements. Approaching the coast, we continue alongside the swampy estuary, lined with mangroves, banyan trees and seafront cafes, until, at Fisherman’s Wharf, we stop and settle on the concrete sea wall. Over 7-Eleven lagers, we watch the sun sink into the deep blue of the Taiwan Strait.

Taiwan’s southern tip - get away from it all, relax and enjoy gentle bike rides, birdwatching, and much more

The crews of the Spanish galleons that sailed up this estuary before those of the Dutch, Portuguese, British, French and Japanese, knew Tamsui as Caisdor. The British called it Hobe Village.

“Tamsui”, though, is a Hokkien name, Daccord explains.

Walking through Tamsui’s spirited Old Street the next day, the smartphone-brandishing, headphone-adorned urban­ites shopping for snacks belie the fact that Tamsui is the departure point from hi-tech Taipei for the bus that circumnavigates the island’s undeveloped headland in a loop, concluding at the second significant port in northern Taiwan’s history, Keelung.

Beneath storm clouds I board a bus with another friend, Yan Qing-qing, bound for Fugui Cape, Taiwan’s most northerly point.

After a short walk along the craggy coastline, we discover the old lighthouse perched on the headland is out of bounds. A military radar installation blocks our path and the coastal boardwalk that looped around it has been destroyed by a storm – planks remain scattered across the sandy bay below. Still, we can agree that we’re about as northerly as it’s possible to get without swimming and that everyone else in Taiwan, bar a few military personnel and perhaps a lighthouse keeper, is to the south of us.

Tainan - a Chinese city that celebrates its Japanese colonial past

Fugui’s harbour is a ramshackle dock to the immediate west of the cape, crowded with blue wooden boats and fronted by a seafood market, where visitors choose a water-sourced delicacy before settling on an eatery in which to have it marinated and fried. Qing-qing is in seventh heaven as we peruse the tubs of live toads, squid and sea snakes; her culinary mantra is “wo ai chi yu” (“I love seafood”).

Thirty minutes by bus to the east, through lush hills, is the Yehliu Geopark, which proves pleasingly weird. Its “beehive”, “fairy shoes” and “sea candle” sandstone forma­tions have been created by thousands of years of weathering and seismic activity, which has produced a landscape best described as “Martian” – were it not for the sea in the background, of course.

The sun sees off the last of the rain clouds, and bathes the land in sepia browns and yellows.

Keelung has seen more than its fair share of history, I learn, as I browse the exhibits and tourist brochures at the YM Oceanic Culture & Art Museum, a small but infor­mative maritime museum housed in a triangular, three-storey building near the city’s station. In 1626, the Spanish arrived, though the Dutch soon saw them off, only to abandon their Taiwanese adventure in 1668. Chinese immigrants began arriving in the early 1700s but they would not be the last. In 1841, during the first opium war, a British squadron shelled the harbour and, during the Sino-French war of 1884-85, the French occupied Keelung for eight months.

That occupation is remembered in stone along Zhongsheng Road, to the east of Keelung’s impressive harbour and a little way out of town, at the Cimetière Français de Kilung, which would be easily missed were it not for its faded tricolour walls. Inside this damp, mosquito-infested graveyard, the names of the fallen are chiselled into head stones: “Ici repose Louis Jehenne, Lieutenant D’Infanterie de Marine, Chevalier de La Legion D’Honneur”. Jehenne died in 1885, at the age of 26, thousands of miles from home.

Keelung is centred on its harbour, with the waterfront Maritime Plaza a popular place in which to convene and absorb the scene. The open plaza is backed by the City God Temple and affords fine views of the city’s own “Hollywood sign” – KEELUNG spelt-out in big white letters in the hills above – and the black kites that dive bomb the rich, jade waters of the harbour in succession, attracting the gaze of keen birdwatchers.

Allied bombing all but destroyed Japanese-controlled Keelung during the second world war, but the city has risen again like a kite with a fresh fish in its nib, and is now Taiwan’s second-biggest container port.

Along the Pingxi Branch Line that departs from Ruifang, an unremarkable market town to the southeast of Keelung City that grew up as a railway junction during the mining boom of the early 20th century, runs an old locomotive, its no-frills carriages connected by traditional round doors. Passing through the verdant Keelung River valley, the railway was constructed by the Japanese to move coal from where it was mined in the interior, but the line has been lovingly reimagined as a tourist attraction, its stations affording day trippers access to nature walks, snack streets and coal-mine heritage sites.

About 20km and 40 minutes down the line is vibrant Shifen, which is only a little larger than the railway station it surrounds. Along the tracks vendors hawk sky lanterns, each representing a wish, which are duly trans­ported to the heavens. At least that’s the idea – the crumpled lanterns festooning the surrounding thick forest suggest the gods aren’t always receptive.

Home to the small Coal Mine Museum, Shifen’s main draw is a waterfall a 15-minute hike through the humid, tree-carpeted countryside that draws day trippers from Taipei.

From the penultimate station – the atmospheric, pretty old mining town of Pingxi, which is hemmed in by verdant hills and overlooked by a red, incense-imbued Guanyin temple – we catch a bus to the hillside town of Jiufen, arriving just as the afternoon light begins to fade.

The last mines in this region closed in 1971. Cheap rent and beguiling scenery attracted artists in the 1980s until the locally shot movie A City of Sadness(1989) turned the town into a tourist bazaar. The visiting hordes included filmmaker Hayao Miyazaki, who used Jiufen as inspir­ation for the village and bathhouse in his mesmerising anime Spirited Away (2001).

Taipei’s historic Datong District gets new lease of life

Jiufen’s car-free cobbled backstreets cling to the hillside like Spiderman and a number of its most photogenic buildings have been converted into teahouses, which serve up fine Gaoshan brews, often as fortification for the adventurous before they set off to climb Keelung Mountain, a 588-metre-tall extinct volcano.

Narrow Jishan Food Street is wall-to-wall with day trippers, who disembark from their buses here to gorge themselves on fish soup, taro balls and a bewildering array of other snacks.

Rain starts falling again, adding drama to the dusk, as Qing-qing and I settle into a quiet teahouse beyond the crowds, to enjoy views of a temple-peppered hillside dropping away towards the sea.