Kano (Nigeria) (AFP) – The technique used by a group of northern Nigerian craftsman to dye cotton sheets indigo has survived for more than 500 years, but the risks of extinction have never been higher.

At the dye pits in Kano, Nigeria's second city, a solution made up of natural indigo, ash and potash is brewed for at least a month in a shaft shaped like a well dug six-feet deep.

The 125 "Kofar Mata" pits were constructed in a walled compound in central Kano in 1498 and assigned to individual families whose descendants are said to still control the trade.

"Clinging to our local technique has been the secret to our survival," said 38-year-old Yusuf Sa'id.

"Sometimes it pays to be conservative."

A commitment to a centuries-old practice may have helped dye pit operators withstand developments that have devastated Kano's textile industry.

Despite being Africa's top oil producer, Nigeria has failed to provide a reliable flow of electricity to its people, forcing industries to spend heavily on generators.

The high cost of operating a business, combined with the influx of cheap foreign fabrics, especially from China, have forced the closure of all of Kano's 20 textile factories over the last two decades, said Ali Madugu, deputy head of Nigeria's main manufacturers union.

Manufacturing in general has all but collapsed across the city of some five million people.

The dye pits are however cheap to run, requiring no electricity, and still have loyal customers seeking the unique product.

Sales hit as tourism hit by security fears

But customers have diminished significantly over the last two years, especially Western tourists.

The violent Islamist group Boko Haram has repeatedly attacked Kano with bombings and gun raids, including a massive assault in January 2012 that killed at least 185 people.

"Tourists used to come in large numbers, on a daily basis, but they have been scared away by insecurity," said Sa'id.

While Nigeria has never been a leading tourism destination, Kano, an ancient city rich in Islamic history, did previously receive more visitors, including expatriates based in Lagos or the capital Abuja.

Asian textile imports a threat

Domestic demand for textiles however remains strong.

Kano's massive and hectic textile market attracts buyers from across Nigeria, Africa's most populous country with some 170 million people, and from the wider Sahel region, but virtually all of the merchandise comes from Asia, said Liti Kukul of the textile traders association.

Nigeria has at various points over the last decade sought to ban, and more recently heavily tax, the import of foreign textiles but the measures have had little impact.

The dye pit operators are now considered the city's last indigenous textile producers but even their output has declined.

Not all of the 125 pits are still operational: it costs $300 (220 euros) to prepare the dyeing solution, an unrealistic overhead cost for some of the families which own pits, even if the solution lasts for one year.

But Ismail Lawan, 40, was hard at work on a recent morning, perched on a low stool, dipping a hand-made cotton sheet into a six-foot well, his rubber gloves stained a dark purple.

The dying process involves dipping the fabric in the solution for a minute, then pulling it out and exposing it to the air for another minute or two.

"You repeat this cycle until you get the desired colour," said Sa'id, explaining that roughly an hour of treatment produces a lighter indigo, but that the cycle can be repeated for up to three hours to produce the darker shades.

Before the dyeing is done, the designers, who are typically women, decorate each cloth with one of ten patterns, including one specific for weddings called "Bride and Groom."

Fabrics made at the dye pits typically sell for roughly $20.

The compound that hosts the pits has inevitably decayed since 1498 and the Kano state government spent $95,000 earlier this year to refurbish the site.

But, according to Sa'id, over five centuries the inner walls of the pits "have never peeled off".

Some may doubt that claim and witnesses present for the original construction are long gone, but Sa'id insisted that the "local materials" used to line the inner walls of the pits have stayed impervious.

Foreigners who have tried to replicate the craft have consistently failed, he added.

But as for what local materials have kept the pits intact, Sa'id said "that has remained our closely guarded secret."