Basking in the Bay of Naples, Capri is Italy at its most dazzling. Whitewashed villas burst with purple bougainvillea, yachts putter around the island’s glimmering grottoes and what was once an idyllic home of fishermen is now an exclusive glitterati haunt.

A machine can power a light, but it can’t watch the sea

But every evening in a modest apartment on the island’s remote south-western tip, a 64-year-old sailor named Carlo D’Oriano slowly climbs 136 steps up a spiral staircase to the lonely lookout tower of the Punta Carena lighthouse and peers through a pair of binoculars across the ocean. When the sun sinks into the Tyrrhenian Sea, D’Oriano logs his handwritten findings in a diary, just as the island’s lighthouse keeper has done each day here for the last 151 years.

You may also be interested in:

• The last surviving sea silk seamstress

• Canada’s tiny disputed island

• Why people are obsessed with Fair Isle

Built in 1867, Punta Carena is one of Italy’s most important lighthouses, and is one of the last in the world to employ a full-time operator. But after being manned by a continuous line of 88 lighthouse keepers predating the dawn of Italian unification in 1871, D’Oriano is its last guardian, and these are his final months on duty.

Last year, D’Oriano received word from Italy’s Ministry of Defence that Punta Carena, like 181 of the country’s other 199 lighthouses, is set to become fully automated on 1 January 2019. When it does, D’Oriano won’t just lose his job – he’ll lose his home of 13 years.

This media cannot be played on your device.

“Think about how many keepers have lived inside these walls, always keeping the light on to guide others,” D’Oriano said, gazing out from the lantern room towards the twilight. “This work is beautiful, but it’s dying.”

As long as there have been ships, there have been light keepers. Thousands of years ago, people lit bonfires high atop cliffs to guide sailors to port. Around 280BC, these ground-lit beacons were raised onto towers, like the Lighthouse of Alexandria. Wood pyres evolved into coal, gas, oil and electricity, and today, according to The Lighthouse Directory, more than 20,500 of these enduring landmarks still illuminate the world’s darkest and most dangerous stretches of coastline.

But as marine navigation tools and satellite automation have become more sophisticated, the need for lighthouses and their human operators has been virtually snuffed out. In fact, with the exception of seasonal volunteers and educational guides, there are hardly any lighthouse keepers left on the planet.

The UK’s last custodian left his post at the North Foreland Lighthouse in Kent in 1998 – the same year, the US Coast Guard automated the last of its 279 federally run beacons. Australia, Finland, Iceland, Ireland, Japan, New Zealand, Norway and many other nations no longer employ a single operator. One stalwart sentinel remains in South Africa; three in France; a handful in India, Myanmar (also known as Burma) and Portugal; and fewer than 50 in Canada.

“There can’t be more than about 200 left in the world,” said Ian Duff, president of the international Association of Lighthouse Keepers, who himself kept the light shining at Skerryvore, Duncansby Head and Tiree Island in Scotland for nearly two decades before being made redundant in 1992. “The reality is, in 10 years, this job will be extinct.”

Yet despite not hiring a single new lighthouse keeper from outside the military since 1987, the captain of Italy’s Lighthouse Authority, Antonello D’Esposito, told me that they still receive roughly 5,000 applications every year for a position that no longer exists.

“I guess I’m the lucky one,” D’Oriano said, wiping the salt from Punta Carena’s storm windows.

D’Oriano joined the navy in 1975 and was stationed up and down the Italian coast for the next 30 years. Then in 2005, a navy commander tipped him off that a rare position was opening at Punta Carena, and that his decades of experience as a nautical technician, harbour pilot and sailor would make him a good fit.

“I didn’t know the first thing about working in a lighthouse,” D’Oriano admitted. “I hadn’t even seen a picture of the place. But when I did, it was love at first sight.”

Rising 28m atop a narrow limestone bluff that plunges into the ocean, Punta Carena casts a striking image. Its rotating optical lens is the second most powerful in Italy, and its flashing beams stretch 25 nautical miles through one of the country’s busiest shipping lanes. The base and spiral staircase were built with lava stone from Mt Vesuvius; the tower is painted Pompeian red; and, fittingly, the whole thing looks like it could be buried by a wave and swept out to sea at any moment.

D’Oriano didn’t sleep much his first few months on duty. Pounding storms frequently brought waves 25m up to his bedroom window, and gale-force winds caused the lighthouse tower to shake and sway.

“At first, I thought these tremors were small earthquakes,” D’Oriano remembered, flipping through old diaries in his office. “But over the years, I’ve learned that an angry sea is more beautiful than a quiet sea. It reminds you that nature exists and that this mass of water is open and alive. Only someone who lives in solitude can understand this.”

When D’Oriano arrived at the lighthouse, two older guardians shared the small keepers quarters below the tower with him. They used to take turns going up and down the tower, shared a kitchen and tiny bathroom together and played cards together outside as the beams quietly flashed through the night. When they retired in 2009, their positions closed with them, leaving D’Oriano to keep the 1,000-watt light, maintain the grounds and pass the time all alone.

These days, when he’s not fixing electrical issues, communicating with the Coast Guard and emptying buckets of seawater from the stairwell, D’Oriano listens to classical music and reads plays by Italian dramatist Luigi Pirandello in the lantern room. In the evenings, he writes poems about the ocean, its fishermen and the constellations. At night, he paints watercolour seascapes and plays guitar on the cots in the empty rooms where the other keepers once lived.

Each autumn, he looks for the bottlenose dolphins and sperm whales that appear offshore. In the summer, he picks wild mushrooms and asparagus in a nearby pine forest; and in the spring, he plants tomatoes, basil, beans and “whatever the seagulls don’t eat” in a small garden by the lighthouse’s front door.

In the nine years since the lighthouse’s other keepers left, D’Oriano has barely taken a day off. Even when his knee was replaced, he still hobbled up and down the tower twice a day on crutches to monitor the coast and flash his handheld torch back at the sailors who signal him each night from across the darkness in a sort of mariner’s Morse code.

“A machine can power a light, but it can’t watch the sea,” D’Oriano insisted. “A human presence provides an added sense of comfort and security for navigators, and it’s fundamental in case something goes wrong.”

Judging by D’Oriano’s diary entries, a lot can go wrong.

“19 August 2016, 10:10: Saw a motorboat on fire and five people jump overboard. Notified Coast Guard for sea rescue. All brought to safety.”

“7 June 2015, 6:10: Awoke to screams in the direction of Tombosiello. Coordinated helicopter search operations, which found a live body near Cala di Limmo.”

D’Oriano has also responded to distress flares, gas spills and shipwrecks. And on 7 February 2013 at 21:05, lightning struck Punta Carena, setting fire to the tower and D’Oriano’s apartment below.

“I raced up and down the stairs in my pyjamas, saw that flames were engulfing everything and quickly put them out,” D’Oriano said. “We were able to get the lighthouse working three days later, but I lived in the darkness with candles for the next five months.”

Despite recent protests from the Capri chapter of the National Sailors Association of Italy, the Italian military is continuing its plans to transform Punta Carena into an unmanned, tele-monitored outpost. The navy recently installed a control panel in Punta Carena’s lantern room to automate the light, and starting in January, a SIM card is supposed to send a text message to the navy’s command centre in Naples if something stops working.

“The problem is that Punta Carena and that entire area is a ‘shadow zone’,” said Antonino Terminello, a captain who’s been sailing off Capri’s south-western coast for the last 16 years. “There’s no mobile signal, no GPS, nothing. That’s why it’s so important for someone inside to constantly maintain and monitor everything.”

My heart is here

After hardly leaving the island for 13 years, D’Oriano can no longer afford to stay. Like so many other stunning seaside properties in Capri, there are talks of transforming his apartment and the empty keeper’s quarters at Punta Carena into a luxury resort. In the last few months, D’Oriano has been setting aside part of his €1,300 monthly salary to buy a small plot of land somewhere quiet in the countryside. He says he’d like to try painting landscapes and hopes to one day publish some of his poems. But he can’t bring himself to pack up his lighthouse home quite yet.

“My heart is here,” D’Oriano said, watching the bright beams streak across the night sky. “When I can no longer keep the light, I think part of me will turn off too.”

Custom Made is a BBC Travel series that introduces you to custodians of cultural traditions all around the world.

Join more than three million BBC Travel fans by liking us on Facebook, or follow us on Twitter and Instagram.

If you liked this story, sign up for the weekly bbc.com features newsletter called "If You Only Read 6 Things This Week". A handpicked selection of stories from BBC Future, Earth, Culture, Capital and Travel, delivered to your inbox every Friday.