Earlier this month Maltby colliery in South Yorkshire closed down for good. At the end of a winter that saw 40% of our electricity needs met by coal – most of it imported – we witnessed the poignant closing ceremony

Nothing better symbolised the passing of a great industry, referred to reverentially as "King Coal", than the lowering of one of the last chunks to have been cut at Maltby colliery next to the grave of the "unknown miner" in the town's cemetery last weekend. His had been the only body to be recovered when a gas explosion ripped through the underground galleries 90 years ago, killing 27 men. Those present wiped away tears, as last rites on an industry that had sustained this community for more than a century were read by the local priest. Wreaths were laid and the colliery brass band played the miners' hymn, Gresford, itself an anthem to another disaster. The short service had been billed as a "thanksgiving and prayer for the future", although the many newly redundant must have wondered what future there could be in an area where good jobs are scarce. Strangely, the closure of Maltby came days before Margaret Thatcher, widely seen as the butcher of the coal industry, passed away.

This South Yorkshire town was built on coal, and thanks to Maltby's huge reserves of "black gold", locals had held out some hope that despite the many closures that have hit the area over the past 30 years, they might just wash past the mine with its 540 or so employees. At its height, Maltby cut more than a million tonnes of coal each year – most of it going on the "merry-go-round" railway wagons to Drax power station, with the rest heading for the Monckton coke works near Barnsley.

Earlier in the day, in Worksop, north Nottinghamshire, the shopkeeper at a local bric-a-brac shop tells me that, although the local mines had closed in the late 1980s and early 90s, the area was still scarred by heavy unemployment. (They barely even burn coal around here any more: I ask him if he might know a coal merchant I could talk to. "You would be hard placed to find a local coal merchant around here," he replies.)

In today's Britain, the roll call of Yorkshire villages that once made nightly news in the early 80s as near civil war gripped the coalfields – places such as Dinnington, Thurcroft, Rossington, Wath, Armthorpe and Grimethorpe – have quietly slid away from public consciousness.

In the last 15 years, international coal prices have been buoyant, Britain's remaining privately operated deep mines becoming more productive and profitable, with a couple, including Hatfield Main in Ed Miliband's Doncaster constituency and the Unity Mine in South Wales even being reopened. The price of coal increased from around $30 per short ton in 2000 to around $150 per short ton in September 2008. But as of October 2008, the price per short ton had declined to $111.50. Prices further declined to $71.25, as of October 2010.

Even as this long winter extended its grip, over 40% of Britain's electricity needs have been met by coal – the bulk of it now imported. But earlier this year came news that work on a new seam at Maltby had had to be suspended, because of unusually high levels of gas, and the pit was to be shut. On top of a disastrous fire at Europe's biggest producing mine at Daw Mill in Warwickshire and the mothballing – closure with the option of reopening later – in January of Aberpergwm drift mine in South Wales, this means that there are only three remaining deep mines left in operation in Britain. These are Hatfield and Kellingley in Yorkshire, and Thorseby in Nottinghamshire. Another Notts pit, Harworth, is currently mothballed. This means we are on the verge of losing both an irreplaceable skills base and, potentially, access to all the remaining coal. And this in a country now virtually dependent on gas and oil supplies from elsewhere; Britain was recently awaiting a gas supply ship from Qatar, after being days away from running out of supplies altogether.

Chris Kitchen, general secretary of the National Union of Mineworkers (NUM), explains: "We are going to be beholden to other countries and suffer the consequences. Once upon a time profitable pits helped ones that weren't making profits because they were developing new coal faces. Now there is no slack." Those close to the industry speak bitterly about missed opportunities. Last year, the government turned its back on investing in a new combined heat and power plant, planned to be built next door to Hatfield colliery. EU Commission officials said the now-scrapped power station would have been 'the most advanced of its type in Europe'. Kitchen says: "For just a minuscule amount of the money wasted on the banks, thousands of jobs could have been created in cutting-edge energy production in South Yorkshire and Britain might have been ahead of the curve when it came to 'clean coal technology' and carbon capture."

Hatfield Colliery in 2006 … a new 'clean' power station in the area was abandoned. Photograph: Getty Images

The arguments may be old, but they are still relevant. One ex-miner, Mick (not his real name), still employed by Maltby's operating company, Hargreaves, says: "They've shut it, because coal prices have dipped. We all know that there are millions of tonnes of the stuff down there." Standing at the entrance to the pit, as the procession prepares to get under way, Kevin Barron, the area's MP, agrees. "We have seen far too many of these closures. Let's see where we are in 50 years' time when we really need these sources of energy," he says. Barron helped lead the charge for his old workplace when Michael Heseltine reeled off a list of planned closures in 1992, moving seamlessly in a Commons statement from "Maltby" to sonorously intone: "Point of Ayr in Scotland". Point of Ayr was, in fact, in North Wales. In response, a bunch of Frickley miners, also from the militant Yorkshire coalfield, headed south in retribution to Heseltine's country pile in Oxfordshire and blocked his gates with a lorryload of coal. Later, some of them dug up part of his front lawn, claiming to have located a large seam of coal running beneath. Maltby was reprieved back then, and it was so successful until recently that it hired 70 young apprentices. As Mick notes: "Many of the men had genuinely thought they would see out their working lives here."

Back at the parade in the town centre, the colliery band and the NUM banners lead a long procession cheered on by Saturday shoppers, perhaps remembering fathers or grandfathers, for most in Maltby will have had some connection with the industry. The final sendoff to more than 100 years of mining in the area has the feel of a procession winding its way through through Wootton Bassett.

It is astonishing to think how far the coal industry has fallen in just 40 years. The 1974 general election is remembered in Maltby chiefly for when Edward Heath asked the question: "Who governs Britain?", with the voters responding, "Clearly not you!" The incoming Labour government rapidly settled the second national coal dispute in as many years with the new energy secretary, a miners-sponsored MP, Eric Varley telling Labour's National Executive Committee: "King Coal is back on his throne again. He is firmly established on it. No one can knock him off. The only way he can lose is by abdication."

Varley was referring to the industry and most likely to the leadership of the NUM at that time – Joe Gormley and his gravelly voiced communist deputy, Mick McGahey. But if there was ever a human personification of King Coal, that must surely have been the late Alf Robens, chairman of the National Coal Board (NCB), whose Daimler number plate famously bore the letters "NCB 1" and who shuttled around the coalfields in an executive plane. It was Robens who may have presided over the shrinking of the industry by half in the 1960s, but it was also Robens who offered up a now-heretical nostrum that Britain should restrict cheap coal imports because it undermined the heavy investment in the domestic industry and threatened the jobs of those who mined it.

I first visited Maltby in 1982, where a friend's father was a face-worker in the colliery. This was before Margaret Thatcher coined the phrase "the enemy within" to describe miners who went on strike to halt her planned ideological assault on the industry. Maltby then was much as it is now, with its allotments, pigeon lofts and friendly banter. The street names next to the Miners Welfare Club are named after a succession of Labour leaders: Lansbury Grove, Attlee Close, Gaitskell Close and Hardie Close.

Britain's last remaining miners became industrial travellers over the past 15 years, moving from pit to pit as they shut. I meet Clare with her daughters at the Maltby march. Her husband has worked at a succession of local mines, and now commutes to one of the last remaining ones, Hatfield Main. "He wanted to be here today, but they wouldn't let him," she says, as we head with banners flying to the welfare club.

Sadly, the years of defeat had led finally to major recriminations among the dwindling membership of the once mighty NUM, whose battalions, Harold MacMillan once declared, should, like "Eton and the Guards", never be provoked. Steve Mace, a local official at Maltby, speaks darkly of impending battles with "the national leadership". That national leadership, in the shape of Chris Kitchen, recently saw off former NUM president Arthur Scargill in the courts over a bitter row involving his occupancy of a flat owned by the union in the Barbican.

Inside the Welfare Hall, a middle-aged couple are doing a brisk trade in commemorative coasters that read: "Keep calm, Maltby and carry on!" while the union banners are laid against the wall. The place is heaving, as queues snake inside to reach the bars. Outside, children play in Hardie Close in the first of the very late spring sunshine. In the distance, set back against a grey mountain of coal waste a century in the making, stands Maltby's monumental winding gear, silent and brooding.

• The subheading on this article was amended on 19 April 2013. The original said 40% of the UK's energy needs were met by coal. That has been corrected to 40% of electricity needs.