If you wanted to see the modern left in all its self-defeating ugliness, the case of Anna Turley v Unite the union and Stephen Walker in the high court couldn’t be bettered. As I watched, I thought the former Labour MP for Redcar’s supposedly socialist enemies looked closer to a crime gang than a trade union.

Turley was one of the Labour lambs Jeremy Corbyn led to slaughter at last week’s election. She is a slight, kind woman and Unite might have thought she would never have the guts to stand tall and teach it a lesson. If so, it made one hell of a mistake.

On 12 June 2016, she tweeted that Len McCluskey was an “arsehole” and recommended joining Unite to vote him out in a forthcoming general secretary election. A passing insult may not seem much to you. But it is a feature of macho organisations to take the smallest slight on their honour as a reason to explode in anger. If Turley got away with disrespecting McCluskey by calling him an arsehole, anyone and everyone might call him an arsehole without so much as a by your leave.

In April 2017, the Unite cheerleaders at the Skwawkbox news site came for her. Its owner and editor, Stephen Walker, says he takes “no funding from any organisation, so our independence can’t be compromised”, a pose that will be harder to maintain after he told the judge that Unite was funding his legal bills. He “didn’t want to insult the intelligence of his readers”, he added, a claim that became ever harder to credit as the case continued.

Turley said the article and a press release from Unite painted her as dishonest. After drawing attention to what it described as the “infamous” arsehole tweet, Skwawkbox said she had joined Unite’s community section, which was meant to be “exclusively for the unwaged”. She had made a “false declaration” just to save herself some money. Unite appeared to corroborate the story by saying that “anyone joining on a fraudulent basis will prompt an investigation”. There had been “a complaint and the union was investigating”.

Len McCluskey, general secretary of Unite the union. Photograph: Hollie Adams/PA

All the worst elements of the left’s mindset were on display. Turley was not an honest opponent but wicked, as all critics of Corbyn must be: a middle-class Blairite who was so deceitful that she used a “false declaration” to join Unite “on the cheap”.

Then there was the paranoia. “Substantial numbers” of rightwingers were joining the unwaged section of the union to unseat McCluskey, the article claimed, although Turley was the only one it could name.

Finally, there was the air of embattled virtue. Unite officials were saints fighting evil forces who would stop at nothing to “undermine Jeremy Corbyn”.

Turley said she had logged on to the site for unwaged members by mistake. Mr Justice Nicklin agreed; there was “an abundance of evidence providing objective grounds to suspect that [Turley] did not know that she was ineligible to join Unite Community”.

I have spent a large portion of my life in the company of libel lawyers. Among the many, many joys they have brought me is the knowledge that, if you can’t substantiate an allegation, you apologise at once.

Turley asked for an apology, which would have cost Unite nothing in terms of loss of cash. Unite and Skwawkbox refused. Like gang bosses everywhere, they cared more about loss of face.

Her solicitor, Simon Gallant, warned Unite that Turley would sue and offered to settle the dispute at next to no cost. Unite’s assistant general secretary, Howard Beckett, said her claim was “spurious”. Unite maintained in court that Turley’s “dishonesty” so “permeated” the case that the judge should reject her claim.

All of you hoping to see a Labour government before you die should know that Beckett is McCluskey’s anointed successor and could have a voice in Labour politics for years to come.

Turley said her friends in parliament warned that Unite would “come for you” if she stood her ground. And so they did. Turley accepted she had made a minor mistakes because she was seriously ill when she drafted her submissions. Unite made her produce her medical records in public. Being forced to talk about “my reproductive organs, my numerous medical procedures [including undergoing a life-threatening operation] and my prospects or otherwise of having children” was “incredibly painful” for her and her husband, Turley said in her witness statement.

I watched Unite’s QC, Anthony Hudson, rage and shout that Turley was “unfit to be an MP”. Unite put its case so aggressively that the judge said its conduct “seriously aggravated the harm to the claimant’s reputation and her distress”.

At a libel trial in the middle of an election campaign, Unite was destroying the good name of a Labour candidate, who did indeed lose her seat. “This has always been about Unite taking out a moderate Labour MP,” Turley told me.

The price is enormous. Unite and Walker’s lawyers said they would appeal, even though the trial judge said they had no grounds. If they fail, and the case and costs associated with it stop right now, Unite will have to pay £75,000 damages to Turley and between £1.5m and £2m in costs.

Unite rejected an offer from Turley to settle. If it had accepted, the case would have finished and the costs capped. As it is, Unite faces paying its own costs of £600,000 or more. The insurers that Turley hired to avoid the threat of the union bankrupting her can claim another £300,000 from Unite.

Her solicitors and her quietly devastating barrister, Kate Wilson, can claim success fees that might double their costs. Bills beyond their imagination will be met by working-class Unite members, who never realised they were paying their subs so that McCluskey and Beckett could play their nasty games.

For all that, the willingness to waste other people’s money, the leftwing sectarian hatred of centrists and the indifference to a woman’s suffering had one benefit: the case of Unite v Turley delineated the modern Labour party to perfection.

• Nick Cohen is an Observer columnist