Per Olof Osterman, a farmer who has spent every one of his 84 Midsummers in the village of Hysingsvik, on the far eastern shore of the Swedish mainland, is supervising the decoration of a Midsummer pole. Beside him, seven-year-old Ida Ek, whose last name means ‘oak’, is tying wild flowers and birch leaves to the upright. Tomorrow, the pole will be raised up and planted in the ground to mark the beginning of the village’s festivities. The swags of wild flowers glow in the evening sunshine, which will finally dim for a few hours between midnight and 2am. Cut grass floats in a haze of gold light.

'We're celebrating summer, the happiness of the sun coming up, and the first hay being cut,' says Per Olof as he fastens the flowers with gardening twine.

Across Sweden, Midsummer is greeted with an exuberance that's hard to understand unless you've experienced the cold and darkness of a Swedish winter. The festival even has its own salutation: Glad midsommar (Happy Midsummer). The origins of the festival lie in the fertility rituals of pre-Christian Sweden, and there's a subtext to the pole that you don't need to be Sigmund Freud to grasp.

'I think originally the pole looked like this,' says Loulou Nyman, an ordained minister, as she helpfully draws a phallus in my notebook. 'Then I think they added this crosspiece to cool it down a little bit and make it seem a bit more Christian.' She's leading a Midsummer service the day after the festival, but accepts that she's got her work cut out. 'We're the most secular country in the world,' she says. 'It makes my job very interesting. Sometimes I feel secular as well. But Swedes are spiritual. They're very close to something, nature maybe, or creation, they just don't want to call it God.'

Midsummer Eve is celebrated across the whole country on the first Friday after 21 June every year. The festival has no parallel in southern Europe, but it's Christmas's non-identical twin: it holds a special place in the national psyche with its own customs, memories and social pressure.

As with much else in Sweden, there's a profound national consensus about the right way to do things. Work stops. Cities empty, and people head to summerhouses. Swedes pride themselves on their closeness to nature and the ideal elements of a Midsummer festival include being with friends in a remote spot, singing, and eating and drinking a lot. A notorious Swedish beer ad - Pripps Blå - portrays the perfect aspirational Midsummer party: buff Swedes jumping off a jetty into the water, and feasting on herring and new potatoes.

The Stockholm archipelago consists of over 24,000 islands and islets scattered across the Baltic Sea. Those nearest to the shore are divided by causeways from the mainland and possess all the amenities of modern Sweden. Other islands are served by free and efficient public ferries. The outer islands are reachable only by private boat. The rule of thumb is that the further out, the greater the isolation: first plumbing, then electricity disappears, until finally, out in the Baltic Sea, tiny huts share a few metres of exposed granite with just the wind and seals.

The archipelago is a place of beauty at any time, but during Midsummer it's the place to be. On the way out to the archipelago from Stockholm, the road winds through the radiant green landscape of a fairy-tale: forests, timber houses, rye fields, fat cows. Wild flowers nod in the hedgerows. Road signs warn of rogue moose.

In Norrtälje, the gateway town to the archipelago, the supermarket is packed with trolleys the day before Midsummer Eve. The prescribed Midsummer foods of strawberries, herring, new potatoes and sour cream are flying off the shelves. A worker complains that they're shifting a tonne of potatoes every hour. Heavily laden cars leave the car park for the islands.

There's also a rush on at the state-run liquor shop. Sweden has a complicated relationship with alcohol - immoderate consumption goes hand in hand with fearsomely high prices, official disapproval and a state monopoly on selling liquor.

For my inaugural Midsummer Eve, I'm heading to the island of Blidö. It's not remote - just two short ferry trips to cross the bay - but the pace of life soon slows. The air is luminously clear and, scoured by sea breezes, feels like it's rejuvenating the lungs. Roe deer skip out of the path of bicycles on the roads.

Blidö is part of Roslagen, the collective name for the northern part of the archipelago. The region has 'The road winds through the radiant landscape of a fairy-tale' a tradition of self-sufficiency and independence. The native islanders are numerically small, outnumbered by summer visitors, who they refer to slightly disparagingly as Zero Eights, after the dialling code for Stockholm. Once home to a few hundred families living a hardscrabble life as fishermen, sailors and farmers, Blidö is now kept afloat by summer visitors and retirees. Its permanent population of 750 swells to 3,000 in the summer - and up to 15,000 on Midsummer Eve.

By midmorning on Midsummer Eve, there are groups of flower-pickers combing the verges of Blidö's narrow roads. They're collecting buttercups, red and white clover, wild geranium, lady's mantle, hops, yarrow, goldenrod, forget-me-nots and cow parsley to make bouquets and crowns, and to adorn the pole that's the centrepiece of the summer celebrations. There's another use for them that no-one I talk to is bold enough to admit to. A superstition holds that if you sleep with seven varieties of wild flower under your pillow on Midsummer Eve, the face of your true love will appear in your dreams.

Just after two o'clock, holidaymakers from the village of Eknäs begin to gather in a field overlooking the sea. Over a hundred families have summerhouses in the area and they've come to celebrate Midsummer. They walk and push strollers along a path through the long grass, where a space has been mown for the celebration in a beautiful meadow of wild flowers. The partygoers gather in a wide ring, sitting in family groups with blankets, coolers and picnic baskets. They lift the pole into place and the festivities begin. Children and adults, some wearing floral crowns, sing and dance around the pole. The loudest cheers are for 'Sm å grodorne', a traditional song with largely nonsensical lyrics that requires the participants to hop round the pole like frogs.

Though the gathering is private, with the air of a family get-together, a polite and curious gatecrasher gets a warm welcome. Ake Vallsten pours me a glass of strong punch and insists I try his sister's strawberry cake - a soft sponge topped with whipped cream and the summer's first strawberries. There is more dancing, then sack races and tugs-ofwar begin. In these beautiful surroundings - navy blue sea, a meadow of wild flowers, tall birches ringing the field - the whole celebration is so tasteful, wholesome and sincerely done that it makes me wish I were Swedish. I reluctantly say goodbye - I've got my own party to go to.

Most of Blidö's summer visitors are long gone by the time winter approaches, but a few people are so smitten by the island, they've chosen to live here year-round. Ingrid Hedman, a journalist from Stockholm, has been seduced by the clear air and silence into moving here full-time. She's under no illusions about the hardship of winter on the island, but she's facing a more immediate challenge: hosting her first Midsummer party. As anyone who's had to cook a Christmas turkey for an extended family understands, the enforced intimacy and social pressure to provide guests with a memorable experience can make Midsummer an unenviable obligation for the host.

'There's a lot of pressure around the festival. Midsummer is all about status,' says Ingrid. 'It's about advertising your social success. It's about spending it in the best place, close to nature, on the archipelago, with close friends. People like to leave decisions to the last minute so they can go to the best places and parties.'

'The worst thing that can happen is that you get stuck in the city, do nothing, and go to bed alone,' says Lukas Lilja, Ingrid's boyfriend.

Ingrid's party kicks off at seven. There are no arguments and everyone turns up. The herrings are tangy and delicious. Schnapps flows. Lukas leads the partygoers in singing Swedish drinking songs. But no-one is tempted to leap into the chilly water. One of Ingrid's guests is a British expatriate who's been living here for the past seven years. He's keen that I grasp the full significance of the Midsummer celebrations. 'I didn't get it at first,' he says, 'but this is Christmas, National Day and your birthday all together. It's the biggest day of the year.'

On the way home, the sun finally dips beneath the horizon after midnight. A sea mist rolls in and floats in ribbons just beneath the trees. A few unsteady revellers stagger down the empty roads. The day after Midsummer Eve, the Blidösund boat takes a party of hungover visitors to a church service on the neighbouring island of Norröra. The Blidösund is a beautiful, coal-fired steamship, built in 1910, which serves a cluster of islands in the archipelago. It has a stately, wood-panelled interior and trim brass fittings. Deep in the bowels of the ship, Alex Strandell feeds the boilers with shovelfuls of coal. He's a 19-year-old trainee stoker and typifies the polyglot, effortless cosmopolitanism of modern Sweden. 'I love steam engines. They're the foundation of modern technology,' he says in faultless English. At the time we speak, he's planning to head to Tokyo to study Japanese for a year and is considering a future as an urban planner.

The boat disgorges its passengers at Norröra. There are no cars on the island. A light rain is falling as the congregation gathers inside the small wooden chapel for Loulou Nyman's traditional Midsummer service. Afterwards, there's a jazz concert in the open air. Christer Ajaxson is on the island of Norröra celebrating his 29th birthday. He spent his childhood summers here. Now living abroad in Germany, he's emphatic about Roslagen's charms: 'I think it's paradise. I hear it calling me every year. But I would never want to live here. That's the nature of paradise. If you live there, it can't be paradise.'

As the rain stops, the sun illuminates vignettes of island beauty that seem to confirm his judgement: a jug of wild flowers perching on a fence-post; a bright yellow bicycle propped up in the hedgerow; nascent green fruits on a cherry tree; lilacs.

For all the traditions celebrated at midsummer, life on the archipelago is very distant even from its recent past. Native-born islanders are few and far between, but on Norröra's southern neighbour, Söderöra, 66-year-old Gösta Söderman still lives in the house where he was born. I meet him on the dock at Blidö, from where it's just a five-minute journey in his motorboat across the sound to Söderöra. With his jolly red neckerchief, fringed leather waistcoat and an air of mischief, Gösta is a legend in Roslagen. Everyone has a story to tell about him: he comes across as mixture of trickster deity and Crocodile Dundee.

One story tells that Gösta sailed to Stockholm, walked into the most glamorous downtown bar - Café Opera - and offered his hunting rifle to a panicked coat-check girl; another, that as a boy he disrupted the Midsummer dances by flinging live snakes at the prettiest girls.

On the wall of his wooden workroom hangs the most enormous gun I've ever seen, a seal-hunting rifle that belonged to his grandfather. It's as heavy and awkward as a scaffolding pole.

Gösta is a living link to the self-sufficient traditions of the island's past. He hunts, fishes and forages for much of his own food. Over glasses of red wine and herring that he's caught and cured himself, he offers recollections of previous Midsummers. On his forearm is a tattoo that he designed himself while he was in a military prison: a souvenir of a distant memory. It's an eagle soaring over a lighthouse and is executed in faded blue ink. Asked what he did wrong, he shrugs without embarrassment. 'I went to go see a girl. I couldn't hitch a ride back to the barracks in time, so they locked me up. Absent without leave.' He pauses to take a sip of wine. 'It was Midsummer,' he adds, as though that explains everything.

Marcel Theroux is a novelist and regular contributor to Lonely Planet Magazine. His most recent novel, Far North, was published in 2009.

The article 'Here comes the sun in Sweden' was published in partnership with Lonely Planet Magazine.