In late October, Aileen McKenzie wrote a blog post endorsing the Scottish Labour leader hopeful Anas Sarwar. McKenzie, a Scottish councillor and trade unionist, was a member of the pro-Jeremy Corbyn campaign group Momentum, as well as Scotland’s equivalent group, Campaign for Socialism, which backed Sarwar’s opponent, Richard Leonard. However, she had spent years campaigning alongside Sarwar, and bridled at the attacks she saw him facing in the media. “I know the real person,” she wrote. “And I know that Anas is the right person to lead Scottish Labour back to power in Holyrood.”

The response was swift. McKenzie received a message from the Campaign for Socialism telling her she had been temporarily removed from the organisation's online groups for the duration of the ballot. “This is my seventh or eighth leadership contest since I was a member, but I would say this has definitely been one of the worst that I have seen,” she told me over the phone in November. “When I agreed to do the post I did expect some backlash, but I didn’t expect it to the extent to what I received.”

McKenzie was particularly horrified to see speculation that she had only endorsed Sarwar because she was sleeping with him. “Anas obviously is married, I have got a partner and a child, so I was very upset,” she said. The comment came not from an anonymous troll, she says, but from a member of the Labour party, a Facebook friend of McKenzie's and an acquaintance in real life.

The 2017 Scottish Labour leadership campaign has, depending on who you speak to, opened a rift in the party or galvanised it. After Kezia Dugdale resigned in August 2017, the contest quickly became a two-horse race between Sarwar – a self-declared Brownite who served in Dugdale’s shadow cabinet – and Leonard, a well-liked, unashamedly old-fashioned left-winger who had spent decades knocking on doors.

Initially, though, it seemed the contest might escape the kind of mud-slinging associated with the UK Labour leadership election of 2016. Leonard, when I interviewed him, had just sacked an aide for using the word “pish” in a press release. He told me at the time that he valued his integrity and his rule was “not to say anything on social media that I wasn't prepared to walk around Sauchiehall Street written on a sandwich board”.

Leonard – who most expect to win the contest - continues to be held in high regard by Labour activists across the ideological spectrum. Critics of his campaign have instead focused on his allies. “At the beginning of this Scottish Labour leadership contest I was genuinely undecided,” wrote John Ruddy, a party activist, on Twitter. “I had known and liked both candidates for many years… But as the campaign has gone on, the way one campaign has been conducted has made my mind up.”

Describing the campaign of Leonard as “one of the most divisive and dirty campaigns I have ever seen”, Ruddy worried that while the left-wing candidate was a “genuinely nice guy”, his followers were running a “scorched earth” policy and trashing Scottish Labour’s legacy.

Duncan Hothersall, a Sarwar supporter and consistent critic of Leonard’s ideological ally Jeremy Corbyn, went further. In a blog post on Labour Hame, which he edits, he accused the “Corbynite left” of trying to capture the party north of the border. The Campaign for Socialism, he claimed, was pumping out “misleading claims”.

There is no doubt that the attacks on Sarwar have been personal. The Herald, a Scottish newspaper, has run a steady stream of articles focusing on Sarwar’s links to his family business. While Leonard’s newly acquired Twitter account has stayed focused on his own campaign, The Campaign for Socialism has retweeted disparaging remarks about Sarwar. A spokesman for the Sarwar campaign told me: “It’s disappointing that this lengthy election has not always been conducted in the comradely spirit that most of us hoped for.”

Yet there is a danger of overplaying the divisions. Tony Lawler, who belongs to the same constituency party as Leonard, told me: “I haven’t experienced any sort of angst or anger for supporting Anas Sarwar.” Instead, he believed “the biggest threat” was “stirring the ship and saying ‘there is trouble, there is strife’”.

In a statement, the Campaign for Socialism said: “This campaign should be about policies not personalities. We are backing Richard because he offers Scottish Labour the best chance of returning to power in Scotland and helping Jeremy Corbyn form a majority at Westminster.”

It said it had been concerned by attempts to discredit the trade union movement, adding: “We hope that whoever wins will do their utmost to ensure the connection between the Labour party and the labour movement remains stronger than ever.”

Comparisons between the 2017 Scottish leadership election and the 2016 UK one can also be overblown. Corbyn faced an insurrection; Dugdale sparked this year’s contest by resigning of her own accord. Leonard, unlike Corbyn, is seen as more of a party insider. Crucially, both candidates have pledged to serve in each other’s cabinet.

As for McKenzie, she hopes the party will reunite after the contest, and blames the hostility not on ideology, but factionalism. “It is almost fascist, Stalin behaviour,” she says of the reaction to her post. “You’re not allowed to have your own choices.”