Imagine that you are a frail, elderly person, perhaps in the last days or weeks of your life. You are so sick that you have been admitted to a hospital ward for care. But care is rarely what you get. Instead you have entered a nightmare world in which weakness is punished and misery ignored.

You are lying in bed, gaunt and almost breathless, the bones in your pale face etched against the pillow. You are whispering because the pain is so acute. You tell the nurses - delicately, almost apologetically - that you are in agony. You do not know that it is because the drugs for your terminal cancer are being wrongly administered, and that you are suffering needlessly as you die. All you know is that no one cares.

Around you, you see other elderly patients, unable to walk alone, crying because nurses won't help them get to toilets on time. Old people are left to sit or lie in their own urine. One old woman is left in her soaking bed for almost nine hours because nurses won't fix her catheter. Some patients are too sick or shaky or confused to feed themselves. They go hungry, while some of the nurses eat the patients' food in the ward kitchens. Patients die alone and unnoticed.

Here's a question for you. When this shocking institutional cruelty is revealed on national television, who would you expect to be banned from working in the health service? The managers who could find nothing substantially wrong with the way the ward was run, even after receiving numerous complaints? The sisters and nurses who saw patients suffering, and were callously indifferent to it? Or the dedicated and caring undercover nurse who was so distressed by what she witnessed that she agreed to spend three months filming it?

Perhaps you already have a fine understanding of the rules that govern contemporary Britain, a country in which whistleblowing, protesting, or embarrassing the authorities is rapidly becoming extremely hazardous for those who dare to do it. Twelve days ago the Nursing and Midwifery Council announced, in one of the year's most outrageous decisions, that Margaret Haywood, the nurse who filmed those scenes for BBC's Panorama, would be struck off the nursing register in perpetuity. No one else involved has been publicly sanctioned, let alone lost their livelihood. Abusing and degrading people at the very ends of their lives is, it seems, much more acceptable than exposing it.

Nothing about the NMC's conclusions stands up to scrutiny. The judgment starts off well, by dismissing the complaints made against Haywood by the Royal Sussex Hospital. The trust had complained that Haywood had broken their own rules by going public, instead of complaining internally.

The panel was scathing about this. Haywood had in fact reported her concerns to a ward manager. In any case, her actions were justified because so many relatives and staff had complained, with no apparent effect. In a rather fine paragraph the panel writes that what Haywood did was defensible because "the concerns were of an exceptionally serious nature. The failure to deliver basic nursing care to these patients, many of whom were in the last stages of their lives, rendered many of their lives miserable. It was so serious because it was so fundamental. There was a failure to meet basic human needs."

The judgment goes on to make clear that it was only the broadcast that forced radical reform. Until then, internal complaints had produced a sluggish and "not very impressive" response. So far, so good. But then the judgment takes a bewildering turn. Before the film went out, Panorama obtained the retrospective permission of every patient - or their relative - whose cases were featured. One elderly man is not featured, but is glimpsed in the background in a handful of shots. Suddenly the panel decrees that the fact that he is on a ward is confidential information, and that therefore Haywood has contravened the nursing code by betraying patient confidentiality. Moreover, she cannot be excused for it because "she should not have gone public until she had explored and exhausted, with management and senior management ... all other avenues of addressing the inadequacies on the ward." The result? She may not work as a nurse again.

What? What? Only a few paragraphs earlier, Haywood is fully justified in forcing change. Now an anodyne background shot of a man in pyjamas means she must lose her livelihood. I read the nursing code. There is nothing in it to back up the panel's preconditions on whistleblowing. They seem to have been plucked out of the air. But the sense of official relief at a reason to ban her rises off the page.

This, if it is allowed to stand, will be a major miscarriage of justice. Whistleblowers know they take risks. The Home Office leaker, Chris Galley, was unsurprised to be sacked last week. But this is a punitive action, clearly designed to deter imitators. Haywood might have expected suspension or a caution, but she acted as she did so that we might sleep more safely in a hospital bed. Will we back her in return? She - devastated - has 18 days left to launch an appeal. More than 15,000 people have signed the Royal College of Nursing petition in her defence, set up to gauge the level of public support.

Haywood deserves ours. If she doesn't get it, the message to every potential whistleblower in Britain will be: don't bother. We don't really care.

jenni.russell@theguardian.com