Image copyright ALAMY

The slag heaps or "terrils" of northern France, relics of a long-gone mining industry, are being regarded with increasing affection by those who live alongside them - and are turning out to have some unexpected uses.

Until a few years ago, the slag hills were regarded as an embarrassment - dirty reminders of a dead industrial past.

The terrils are familiar to anyone who has travelled on the motorway or Eurostar train between London and Calais or Brussels - massive black pyramids dotted across the landscape.

They are the residue of 300 years of mining in the rich coal seam that extends west to east just below the Belgian border.

But now it is a quarter of a century since the region's last mine closed. And slowly communities are starting to claim back their once-despised colossuses.

From being synonymous with pollution and decline, the black hills are now seen as symbols of a proud industrial heritage.

Image copyright ALAMY Image caption The slag hills at Loos-en-Gohelle are now recognised as a world heritage site by Unesco

And what were once barren heaps of spoil are being transformed in ways that the miners who made them would never have dreamed of.

"The terrils represent all the toil and the hardship of our forefathers," says Patrick Offe, a guide at the association La Chaine des Terrils in Loos-en-Gohelle.

"Because of the mines, the people here were tough and the bonds between them were strong. Life was extremely hard. Today we are proud of that."

Visiting the terrils reveals some surprises. First of all how different they are.

The 150 metres giants like the pair at Loos-en-Gohelle are exceptional. Most are smaller, and not all are pyramid-shaped. Others are long low hills, or form bowls in which reservoirs have been created.

There are supposed to be more than 300 overall, but no-one is sure of the exact number. That is because some have been exploited for road-ballast, some have been levelled, and others have gradually been taken over by trees and vegetation and are hard to spot.

And that is the other surprise. Far from being mounds of desolation, the terrils are surprisingly useful.

At the village of Rieulay, the Chevrerie des Terrils - literally the goat-farm of the slag-heaps - exploits this unexpected biodiversity.

Julien Graf set up the business two years ago with encouragement from the local council, and today grazes his flock of 40 animals in the abundant terril brush.

"This is what they call a 'pioneer' environment - an ecosystem in which vegetation is just beginning to re-appear. And it's very rare. The goats prevent the terril from being completely taken over by trees and brush. That has happened in a lot of other terrils where you can no longer see the black soil," he says.

The soil is obviously very poor. Essentially it is what the miners brought up from underground then discarded because it was not coal.

Image copyright Thinkstock

But nature is remarkably resilient. First lichens appeared, then tiny plants clinging to the stones. Today there are birch forests and acres of brush.

"Being black, the soil retains the warmth which encourages growth. The vegetation is tough and fibrous - and that is perfect for goats. Goats don't like grazing on grass. They prefer shrubs and bushes like we have here," says Graf.

"I find it very moving to think how the terrils here have been transformed. They used to have such a negative image. They were just sad, dirty places where no-one wanted to go. But they have re-conquered our hearts."

A few miles to the west is an even more surprising initiative - France's most northerly vineyard, on a slag-heap.

Again the versatility of the terril is what surprises. Wine-grower Henri Jammet - who comes from the warmer climes of Charente in the south-west of France - explains that much depends on the age of the slag.

Image caption Henri Jammet is growing grapes on the terrils

Image copyright ALAMY

"The earlier the terril, the more is likely to grow on it. In the 18th and 19th Centuries, they sorted by hand - so a lot of what got chucked aside still contained elements of coal and other minerals.

"Often the slag continued to combust quietly over the years, which ultimately created a soil which - while not exactly rich - contains fertile elements.

"But the newer slag-hills were made in the machine age. Everything got chewed up and there was not much goodness left."

The vineyard at Haillicourt was planted in 2011, and this year's will be the third harvest. In 2013 it produced 150 bottles, and last year 300. The wine is labelled Charbonnay - a play on the word charbon, meaning coal.

"People here were very surprised, but the wine is great. The terril is stony - it drains well because it is on a slope; the earth is black which keeps in the warmth; and we face south - all things that help the vines," says Jammet.

"Obviously the soil is poor - but that is good. Vines need to struggle in order to bring out the best in the grape. Our wine is sharp because they don't have the sun up here to reduce the acidity - and it's got the proper Chardonnay citrus notes."

Across the region, other imaginative ways are being dreamed up to restore the terrils to life. At Noeux-les-Mines, there is an artificial ski-slope. Several municipalities have created nature trails or heritage sites.

Some of the terrils were even put on the Unesco world heritage list in 2012 when it classified the Pas-de-Calais mining basin as a special site.

At Loos-en-Gohelle, joggers and cyclists toil up the slopes, and groups of children get lessons about the newly resurgent plants and other wildlife.

"At the end of the day, what is a terril but a hill of stones which we took from nature - from underground?" says Patrick Offe.

"Well now we are giving it back to nature. And nature then gives it back to us once again - by bringing flowers, and trees, and animals."

Subscribe to the BBC News Magazine's email newsletter to get articles sent to your inbox.