As the first hints of an autumnal chill chime with a revived sense of Brexit dread, this may not seem the best time to talk about hopeful glimmers of the future. To do so with reference to Britain’s railways, moreover, might look like lunacy, given the summer’s run of headlines – about power cuts, the apparently awful new sleeper service from London to Scotland and, last week, the announcement of yet another round of fare rises. But a fortnight ago the experience of travelling through spectacular countryside on single-carriage trains filled me with an optimism I have not felt for some time, and a sense of the possibilities that still lurk beneath our national nightmare.

With my dad and my 10-year-old daughter, I was on the Heart of Wales line, a 120-mile, mostly single-track route that runs between Shrewsbury and Swansea. As well as six tunnels and two glorious viaducts, there are 29 stops, 16 of which are so-called “request” stations, meaning that passengers who want to use them must either tell the conductor or, if they are getting on, make themselves visible as the train comes into view (you basically just have to stand on the platform, though jumping up and down adds to the fun).

Some of the stations look more like solitary platforms plonked into the midst of near-empty scenery; others serve such towns as Llandeilo, Llandovery, Llandrindod Wells and Knighton. The secret of the line’s unlikely survival, it is said, is that it passes through at least three marginal Westminster constituencies, meaning that no one in power has ever fancied signing off on its closure. These days it also offers a more positive picture of the key to staying open, and the benefits of what used to be called a “social railway”.

Facebook Twitter Pinterest ‘The experience of travelling through spectacular countryside on single-carriage trains filled me with an optimism I have not felt for some time.’ Ramblers at Craven Arms station on the Heart of Wales line. Photograph: Les Lumsdon

Every day we did a hill walk before having lunch, eventually collecting our bags from wherever we had stayed and making our way to the local station to get on the train that runs through the late afternoon (on weekdays and Saturdays, there are four services, with two on Sundays). On board, there were usually walkers like us; teenagers and twentysomethings doing the social rounds in the absence of a car; a large Scandinavian family carrying camping kit, apparently on their way to Shropshire; day-trippers getting as immersed in bucolic wonderment as they could before returning home.

Things on the line are far from ideal: people who live along it want more frequent services, at more regular times; the rolling stock – which will be updated and expanded by 2022 – looks well past its prime. But as we travelled, there was something unexpectedly modern about the whole experience.

Some of this was banal: the fact that I had booked our first tickets online, the contactless payments for every subsequent journey, the availability of onboard wifi. But the sense that the Heart of Wales line has something to tell us about the future is also down to aspects of how it is run, and the way they gently defy the old orthodoxies. The political right would wonder why a heavily subsidised service that so defies the strictures of the market is still in existence; the traditional left might decry all the line’s unstaffed stations and the widespread involvement of volunteers. But in its own flawed, qualified way, it offers a lesson in the fact that many – most? – things are best run not according to the cruelties of the market, nor by distant bureaucracies, but with the involvement of people who live close to services and actually use them.

A glimmer of hope after the cuts that derailed the Welsh economy | Letters Read more

The basics might seem grimly predictable. The track and station buildings are the property of the state-owned Network Rail; since a franchise change last year, the trains are run by Transport for Wales Rail Services, a consortium split between the Franco-Québécois transport firm Keolis and Amey, which is now owned by the giant Spanish corporation Ferrovial.

Thanks to local adoption schemes, as the line’s promotional material puts it, “each station is made available to local people – gardeners, rail enthusiasts, small rural enterprises and volunteers” – whose work is often a joy to see: elegant flower beds, information boards, spotless platforms. Woven into all this is the work of the Heart of Wales line Development Company, a nonprofit enterprise founded about five years ago and modelled on a comparable initiative focused on the 73-mile Settle-Carlisle line. As well as convening a regular forum that includes passengers and local councils and businesses, it has turned the station buildings at Llandovery into a community cafe and event space, introduced a “hub” to the land next to Llandeilo station that acts as an outlet for local food producers and lately worked on the network of footpaths known as the Heart of Wales line trail, which follows the line, and is aimed to bring walkers – like me – on to the trains. The company is a perfect example of a new movement of community rail partnerships, which is reckoned to extend to about 60 organisations around the UK. Their umbrella body says its mission is to “help people get the most from their railways [by] promoting social inclusion and sustainable travel, working alongside train operators to bring about improvements, and bringing stations back to life”.

Facebook Twitter Pinterest ‘The network of footpaths known as the Heart Of Wales line trail is aimed to bring walkers – like me – on to the trains.’ Photograph: Kevin Rushby/The Guardian

10 classic UK trips by public transport Read more

From there, it is not that big a jump to a question that occurred to me every time I set off on another Heart of Wales journey. With the climate emergency beyond doubt and the car falling into cultural disrepute, why is it that beyond Britain’s big cities our railway services are such an inconsistent, Balkanised mess, and that after a decade of austerity public transport is in such a parlous state? Once you have been reminded that such tiny Welsh places as Llangadog, Ffairfach and Knucklas have railway stations while large-ish population centres such as Dunstable, Abingdon, Brecon and Wisbech no longer do, the answer is surely not to think about shutting the former’s limited train services down but to restore the latter places to a proper public transport network. Building on plans for new stations in Wales, Greater Manchester and the west of England, why can’t scores of places currently without a railway be granted such a basic entitlement? If thousands of stations were so stupidly axed when we believed in a car-based future, belatedly starting to reverse that huge blunder ought to be a matter of urgency. Clearly, to move away from the failings of the current system and begin such a revolution, a large measure of public ownership and control of both trains and infrastructure will be imperative, though not of the old-fashioned kind. Why not embrace a system of transport devolution, whereby small lines could be run by some of the organisations on the ground?

Sceptical voices will tell us that such dreams will never be realistic. But if we can sideline every ounce of economic sense in pursuit of leaving the EU and invite disaster, why is dependable, democratic, green transport for all such an impossible idea? Perhaps, when Britain has eventually found some way of accepting that it is located in northern Europe and dealing with modernity, a positive legacy of Brexit will be the death of illusory policy limits and a realisation that there are no end of things we can do if we simply decide to. As I passed through elegant Welsh stations festooned with flowers, past mountains and through a tunnel or two, the point felt unanswerable; now I am back at home, it still does.

• John Harris is a Guardian columnist