Musicians performing at the Crepissage festival in Timbuktu, Mali, in front of the Sankore mosque. Photograph: Alamy

The pickup halted in Kidal, the far-flung Malian desert town that is home to members of the Grammy award-winning band Tinariwen. Seven AK47-toting militiamen got out and marched to the family home of a local musician. He wasn't home, but the message delivered to his sister was chilling: "If you speak to him, tell him that if he ever shows his face in this town again, we'll cut off all the fingers he uses to play his guitar with."

The gang then removed guitars, amplifiers, speakers, microphones and a drum kit from the house, doused them with petrol, and set them ablaze. In northern Mali, religious war has been declared on music.

When a rabble of different Islamist groups took control of the region in April there were fears that its rich culture would suffer. But no one imagined that music would almost cease to exist – not in Mali, a country that has become internationally renowned for its sound.

"Culture is our petrol," says Toumani Diabaté, the Malian kora player who has collaborated with Damon Albarn and Björk, to name but a few. "Music is our mineral wealth. There isn't a single major music prize in the world today that hasn't been won by a Malian artist."

"Music regulates the life of every Malian," adds Cheich Tidiane Seck, a prolific Malian musician and producer. "From the cradle to the grave. From ancient times right up to today. A Mali without music? No … I mean … give me another one!"

And yet that is the bland reality dawning on this once joy-filled land. International observers claim the leaders of the three armed Islamic groups who now control the northern Malian cities of Timbuktu, Kidal and Gao are motivated by money and power rather the dream of a caliphate in the Sahel. There are strong ties between these groups and the less than holy interests of major drug-traffickers and arms smugglers.

But many of the mujahideen who have zoned in on the conflict from all over the Muslim world are fired by an unquestionable religious zeal. The same goes for Iyad Ag Ghaly, a Touareg strongman and born-again Salafist, who founded the Ansar-ud-Deen movement at the end of last year.

"He believes in what he's doing," says Manny Ansar, director of the Festival in the Desert that has been taking place every January in and around Timbuktu and Kidal since 2001. "And that's what frightens me. I'm not convinced that he wants to kill everyone who is not a Muslim, like the people in al-Qaida do, but I've seen him giving up the fruits of this life for God."

Back in the 1990s, before he succumbed to the preaching of the Pakistani proselytising movement Tablighi Jamaat, Ghaly liked to smoke cigarettes and hang out with musicians from Tinariwen. He even composed songs and poems of love, rebellion and the beauty of his desert home. Now music, and with it a major source of communal cohesion and well being, has either disappeared or gone underground throughout the territory under his control.

An official decree banning all western music was issued on 22 August by a heavily bearded Islamist spokesman in the city of Gao. "We don't want the music of Satan. Qur'anic verses must take its place. Sharia demands it," the decree says.

The ban comes in the context of a horrifically literal and gratuitous application of Sharia law in all aspects of daily life. Militiamen are cutting off the hands and feet of thieves or stoning adulterers. Smokers, alcohol drinkers and women who are not properly attired are being publicly whipped. As one well-known Touareg musician from Kidal says: "There's a lack of joy. No one is dancing. There are no parties. Everybody's under this kind of spell. It's strange."

Tinariwen, seen here performing at the World Cup 2010 Kickoff concert in Soweto, South Africa. Photograph: Jon Hrusa/EPA

Ansar adds: "People think that the problem is new. But the menace of al-Qaida started to have an effect on us in 2007. That's when al-Qaida people started to appear in the desert. They came to the nomad camps near Essakane [the beautiful dunes to the west of Timbuktu where the Festival in the Desert used to be held] and at first they were pleasant and said, 'Don't worry, we're Muslims like you.' Then they began to say, 'We have a common enemy, which is the west.' That's when I understood that things were going to get difficult."

The Kel Ansar

Remarkably, al-Qaida in the Islamic Maghreb (Aqim) never targeted the festival or any of the thousands of westerners who braved the journey to attend it. According to Ansar, some people put this down to the fact that his tribe, the Kel Ansar, are said to be descended directly from Muhammad and are highly revered. "Others even thought that we cast spells to block their route," he says with a wry laugh. In truth, Aqim knew that if they wanted to keep the locals sweet and compliant, they were well advised not to mess with the Kel Ansar.

Not all music events were so blessed. Returning from the Tamadacht festival near the eastern town of Anderamboukane in January 2009, a British tourist, Edwin Dyer, was kidnapped and sold to Aqim, who beheaded him four months later because the UK government refused to pay a ransom. It forced the Festival in the Desert to move into the safe confines of Timbuktu city limits in 2010.

This year in January, no doubt the last festival to be held in Timbuktu for a while occurred in an atmosphere of high alert after recent kidnappings and the murder of a German tourist by al-Qaida. The event was attended by Tinariwen, a host of other Touareg and Malian musicians and Bono.

"I was impressed by Bono's courage and that of his team," Manny says. "He asked the soldiers who were assigned to protect him to leave him be and let him roam around the town freely or go and drink tea out on the dunes. But I wondered if I wasn't a bit mad myself to let him do that. I mean, Bono, kidnapped! Imagine that." La Maison, the hotel in Timbuktu where Bono and his entourage stayed, is now the headquarters of the city's Islamic tribunal.

Manny felt like giving up when the rebellion erupted a few days after the end of the festival. But after talking to many musicians, as well as friends and international backers, he decided to organise a Caravan of Peace and Unity that will tour west Africa and visit refugee camps in February next year. He will also be promoting the Festival in the Desert in Exile in Europe, the Middle East, the US and elsewhere. "It's my way of fighting back," he says. "Before our music was heard in Essakane. Now it'll be heard in all the big festivals in the world. So it's the opposite of what the Islamists want. It's our victory and their defeat."

Meanwhile, almost all the musicians in the north have fled the country like more than 500,000 of their fellow Malians, most of whom languish in refugee camps in Algeria, Mauritania, Niger or Burkina Faso. It is the biggest humanitarian crisis the Sahel has ever known. "There's no music up there any more," says Vieux Farka Touré, son of the king of the West African blues, the late Ali Farka Touré. "You can't switch on a radio or a TV, even at home."

The town of Niafunké just south west of Timbuktu, where Ali Farka Touré was mayor for many years, is now under Islamist control. "I know that if Ali were to awake from his tomb today," says Afel Bocoum, Touré's former sidekick and Albarn's partner on the 2002 Mali Music project, "he would just go straight back into it. He would die twice." Both Bocoum and Vieux Farka Touré have fled south to the safety of the Malian capital, Bamako, with their families.

But down south, music is also in crisis, for related reasons. The military coup that toppled President Amadou Toumani Touré on 23 March and kissed goodbye to one of Africa's most lauded democracies has left the capital, Bamako, fearful and economically depressed. "People just aren't used to meeting soldiers in the street, so they tend to stay at home," says Adam Thiam, one of Mali's leading journalists.

Many live music venues in Bamako, such as Le Diplomat, where Diabaté and his Symmetric Orchestra used to play every weekend, have closed. The same goes for hotels and restaurants, starved of their once plentiful foreign tourist clientele. Nightclubs and weddings are still thriving but the trend is to save money by hiring sound systems and DJs rather than live musicians. "People use what they earn to feed themselves, not to have fun," says Bassekou Kouyate.

But in west Africa, when the going gets tough, the rappers get going. Like Y'en A Marre, a collective that ignited nationwide debate during Senegal's election crisis last year, rappers in Mali have stepped up to denounce political skulduggery, Islamism and military rule.

Malian singer Rokia Traoré. Photograph: Simon Grosset/Rex Features

"I don't give a fuck what they say," is Malian rapper Amkoullel's terse answer to a question about the Islamist music ban. "We won't let them get away with it. We don't need them to teach us how to be Muslims. We're a secular tolerant country, where everyone declares their religion according to their feeling. And in any case, they know that a Mali without music is an impossibility."

Amkoullel set up his own pressure group of rappers, activists and friends called Plus Jamais Ça (Never Again). So far he has released a couple of videos, including one called SOS, which has become a YouTube hit. It has also been censored by the state broadcaster ORTM, which is still under the heavy hand of the military.

"We had this feeling that a heavy blow had been dealt to democracy," Amkoullel says of the 23 March putsch. "And it had been done in a period of popular disillusion. It's as if in the collective consciousness, democracy was a failure in Mali." Like Les Sofas de la Republique, the other rap collective raising the standard in rhyme for unity, democracy, peace and good governance, Amkoullel and his team have been organising demonstrations, debates and gigs. He has also received three death threats.

"I knew that our phones were being bugged," he says. "Then I got this call that was like, 'Yeah … we're watching you, so you'd better calm down or take the consequences.' The second message wasn't from the same person. 'You're talking too much,' they said. 'Shut up or you'll disappear and won't understand a thing.' That was much clearer!"

And yet, despite the twin-pronged threat to the culture they have made world famous, all the musicians of Mali agree it remains at the core of their identity. "I'm a Muslim, but Sharia isn't my thing," says Rokia Traoré, one of Mali's most famous international stars. "If I couldn't go up on stage anymore, I would cease to exist. And without music, Mali will cease to exist."