The Marrakech express train rattles off into the hinterland of Morocco through a desert that stretches on forever, an inky black sky crowding in on the lonely palm trees. It's impossible to exaggerate the quietness of the rolling hills, with stars stretching to infinity, and only the most occasional light in the gloom.
Not too many hours later, I'm standing amid the most crazed cacophony, surrounded by massed drums, hucksters shouting, the reedy spiraling of snake charmers, performing monkeys, buzzing motor scooters and amplified calls to prayer. I don't know of another country that's so quiet and so loud, so calm yet so frenzied.
I'd begun my journey in Tangier, a tight-packed city whose foreignness seems familiar; wander around the medina, and for all the noise and intensity it's easy to orientate yourself, its hippie and Beat landmarks all fall into place. I look for a coffee and happen on the Café Central, regular haunt of William Burroughs and Brion Gysin; I search out seafood and am soon queuing outside the Restaurant Populaire Saveur de Poisson on the Escalier Waller. I'm halfway through a succulent bowl of tiny squid before I realise I'm just a couple of doors down from a legendary Sixties haunt, where store owner Akhmed hosted Keith Richards, Brian Jones and Anita Pallenberg, all keen to sample the hash he kept in an antique wooden box.
It's a ravishing but strangely reassuring city – only as you travel deeper into the country do you find that vertiginous, roller-coaster thrill of the unknown. I'm travelling in the footsteps of Brian Jones, one of the first to seek out what we'd today call world music, which still prospers in the nooks and crannies of this serene, desert land.
The staff at Tangier's modern, French-styled railway station seems incredulous that anyone would want to take the sleeper ("Couchette? Vraiment?") but the train is comfortable, all wood-grain Formica and red leatherette. Happily, I'm sharing the cabin with interesting travel companions – a Moroccan and a Dutch student. We talk politics, food and electro music until we drift into fractured dreams. Come dawn, the glare and wide-open spaces of Marrakech are a disorientating contrast. This city's tricky to read, streets full of dead-ends, cab-drivers more rapacious. Still, it's easy to locate the beating heart: Djemaa el Fna.
Opposite the Koutoubia mosque, Djemaa el Fna square has hosted market people and musicians for most of the last millennium. In some ways – the hassling, the huckstering – it's identical to every other market. Yet it's unique; there's nothing battery-powered, hardly anything made of plastic. For two nights, I'm drawn to the stalls where white-coated vendors minister over huge piles of sea snails, stacked up in a deep red-brown broth. I'd sip all night, but the music is calling.
The square rattles and resonates with the beat of a hundred drums; it's easy to find a good band, for you can feel the electricity crackling around the crowd, and before long I'm sitting on a little plastic stool listening to a group led by a wiry and charismatic Berber named Hassan Khontija.
By my second night in the Djemaa el Fna, Hassan and I have become friends; maybe it's the few dollars' worth of dirham that I drop in the tin each evening, maybe it's just because I appreciate the music, which is expert and authentic. Time becomes unreal; I spend hours that pass instantly, listening; the drums boom and the musicians spool out jagged riffs while Hassan directs both crowd and music. I love Hassan's combination of well-honed musicianship and hawker showmanship; if the money in the kitty is insufficient, he cheerily harangues the crowd for 15-minute stretches, refusing to play a note until they hand over enough dirham. As the stars come out over the square, Hassan lights a little propane lamp, sending giant shadows dancing over the entranced crowd.
Later, Hassan tells me, via a French-speaking musician from his band, that he's been playing in the square for more than 20 years; he learned from his family, who came from Agadir. I wish I could stay for more questions and music, but I'm headed for the mountain village of Joujouka, where founder Rolling Stone Brian Jones and poet Brion Gysin once travelled to hear what William Burroughs described as a "5,000 year old rock'n'roll band".
Two train journeys take me back north, to Ksar el Kebir, a small, landlocked town, from where Joujouka is a 30-minute, bumpy mountain drive. Central to a scattering of one-storey white stucco houses, Joujouka is dominated by a large, communal well, set in front of a grand archway that protects its most hallowed site. Inside, a small courtyard opens up to a stark, simple mosque, resembling an early Christian basilica. It hosts a sarcophagus containing the relics of the local saint, Sidi Ahmed Sheikh, who brought Islam to northern Morocco and was said to heal the mad and the sick. Yet, just like Christianity, Islam incorporated ancient customs and the annual Master Musicians of Joujouka Festival, as it's now known, is a fertility rite akin to the Roman ceremony of Lupercalia.
For the next three days, I breakfast on olives and rghaif – sweet, spiral pancakes – in a spartan, courtyarded house where Brian Jones stayed in August 1968 during a pilgrimage to record the famed Master Musicians, two dozen villagers who continue a tradition that dates back to the 16th century. In the afternoon, we lie on patterned carpets, listening to the gentle acoustic L'Aitha, which prepares us for the main event: powerful trance music designed to summon ancient entity, Bou Jeloud. A wild figure reputed to live in a nearby mountain, he is said to be a manifestation of the god Pan, traditionally played by a local sewn into goatskins. It's said the ceremony changes his earthly vessel forever. "When you put the skins on, you never take them off," the villagers tell me.
As evening falls, the musicians walk into the tent in formal, almost military robes. From the first beat the music is arresting, melodies carried by seven or eight rhaita, oboe-like pipes – the pipes of Pan – flanked by five or six drummers playing tbel, primitive military-style drums. Pipers play a call and response; over the next five or six hours, then three successive nights, I hear hundreds of melodies, some surely blues or folk, some impossibly alien, while the drums boom out relentlessly hypnotic polyrhythms. The volume is overwhelming – your ears ring, your brain shakes, your teeth rattle. I've lost all consciousness of time, when suddenly a new energy fills the air – a goat-skinned apparition leaps on stage and the pipes distort into a rush of noise, like a Jimi Hendrix guitar solo. Bou Jeloud dances across the tent, shaking his hips in front of the musicians, who sweat with the intensity of their work. The little goat-skinned creature taunts musicians and crowd, brandishing olive branches, swiping young women and occasional unwary men.
It's a provocative, powerful performance. But it's fragile and endangered, too. The festival was only reintroduced in 2008, after a long hiatus, to mark the anniversary of Brian's visit; perhaps the absence of this ancient fertility rite explains why the village school now hosts only a dozen children. But still, the teenage boys I chat to around the village insist that they too will one day dance Bou Jeloud. Perhaps the calmness and craziness of this, and other such resonant places, will endure.
Paul Trynka's new Brian Jones biography, 'Sympathy For The Devil' (Transworld) costs £20 (trynka.net)
Marrakech is served from Gatwick by British Airways (0844 493 0787; ba.com) and Royal Air Maroc (020-7307 5800; royalairmaroc.com); from Bristol, Gatwick, Manchester and Stansted by easyJet (0330 365 5454; easyjet.com); from Luton and Stansted by Ryanair (0871 246 0000; ryanair.com).
The Master Musicians of Joujouka will hold a one-night Burroughs 100 event on 15 November. The Eighth Master Musicians of Joujouka Festival takes place 5-7 June 2015. joujouka.net
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies