As Jeremy Corbyn’s top aide, Seumas Milne, drove to Finsbury Park on election night to watch the exit poll with his boss in an anonymous office lent by a charity to skirt the media scrum, he took a call from the Scottish National party’s Westminster leader, Ian Blackford.

The genial Scottish MP wanted to prepare the ground for the two parties to enter into immediate talks, if the result was a hung parliament – but Milne told him there was no chance of that.

After a bruising six-week campaign, he and Corbyn’s lieutenants were resigned to humiliation at the hands of Boris Johnson.

Labour’s defeat was a long time in the making. Two years of parliamentary warfare over Brexit had left deep scars on the personal relationships that once formed the glue for Corbyn’s radical political project.

Speaking to many of the leading figures in Labour’s election campaign, a picture emerges of tactical spats, mixed messages and frayed tempers – not least Corbyn’s own.

Many of the senior players were the same as in 2017 – the shadow chancellor, John McDonnell, chaired the daily 7.30am calls to set the agenda for the day ahead; the policy chief, Andrew Fisher, oversaw the manifesto; the former Corbyn aide Karie Murphy led the operational side of the campaign, and Milne was in charge of strategy and communications. Jennie Formby, handpicked by Corbyn to be Labour’s general secretary, oversaw management and budgets.

Yet this group had been on different sides in the painful dispute about Labour’s Brexit stance – McDonnell and Fisher were instrumental in helping to persuade Corbyn that backing a second referendum was the only way of safeguarding the leftwing political movement they had built. By contrast, Milne and Murphy – as well as the Unite union’s chief of staff, Andrew Murray, and the Corbynite PR Steve Howell, both of whom sat on the election strategy group – believed that fateful decision would cost Labour dear in leave-supporting seats.

Facebook Twitter Pinterest Jeremy Corbyn with Seumas Milne, left, and Andrew Fisher. Photograph: Leon Neal/Getty Images

And this difference of analysis continued to reverberate throughout the campaign. There was a strongly held perception in Labour’s HQ at the outset that Labour still had more work to do to pacify remain voters, after its switch to backing a second referendum.

As for leave voters, many of whom were heavily concentrated in a swath of Labour-held seats being targeted by the Tories, the plan was to change the subject – focusing as much as possible on other issues, including public services and the NHS.

“It felt like the People’s Vote campaign in there,” said one senior member of the campaign team, who recalled being warned, in respect of Labour leave voters: “We don’t want to prod the beast!”

Howell, who had overseen Labour’s digital campaigning in 2017 and was brought in this time to look at targeting and polling, was alarmed by the prevalence of the view that Labour could win by focusing on remainers.

“A mythology developed – Paul Mason was one of the early advocates of it – that we could win an election on remain votes. And that even in leave areas, the vast majority of our voters were remain. But, while it’s true that the proportions are something like 70% to 30% nationally, in strong leave areas, as many as 40% to 50%-plus of Labour voters are leavers,” he said.

He and other sceptics about Labour’s shift towards a referendum always felt it was fruitless to try to skirt the issue. “In the end, you can’t just fight a battle and ignore your opponent. You can’t just say: ‘We’re fighting at sea’, if your opponent is mounting a land invasion,” said one party strategist.

Even Labour’s attack line on the NHS – focusing on the risk that it would be handed to Donald Trump as part of a trade deal – had an anti-Brexit undertone to it. And focusing on austerity, which still featured heavily in Corbyn’s stump speeches, was perhaps a less potent weapon against a Tory party that had ditched Philip Hammond’s rigid fiscal discipline.

“That was one of the things that we were a bit caught on the hop about: Boris suddenly started throwing austerity overboard. He had deprived us of our core message,” said the adviser.

Labour’s approach to targeting was almost a mirror image of 2017’s. Then, Corbyn and his lieutenants blamed the excessive caution of party officials for blunting their attacking edge.

This time, they began with an ambitious list of 96 targets – 66 of which were attacking seats, and 30 defensive.

That was partly because the job of any opposition is to get into government, and it would have appeared defeatist to target fewer seats than Labour needed for a majority.

But the campaign team also hoped some of the magic that propelled them to such a close result in 2017 would spark the campaign into life again: the rousing rallies, Corbyn’s comfortable-in-his-own-skin authenticity, Tory missteps. “We were all too hypnotised by our achievement in 2017, and we thought that however bad the situation was, once the campaign got going we would catch up,” said one party source.

Some events – including an upbeat launch at Battersea Arts Centre, and the unveiling of the manifesto at Birmingham City University, where Corbyn held the document triumphantly aloft against a dark pink backdrop – almost recaptured the buzz of two years earlier. But veterans of that election remarked that the crowds in 2019 were generally smaller this time, and failed to build as the weeks went on.

Play Video 1:31 Labour manifesto: Jeremy Corbyn's key pledges in 90 seconds – video

Labour’s manifesto itself was a casualty of the fractious working relationships that dogged the campaign. Milne was widely viewed internally as the most important single decision-maker in the 2017 campaign. But this time, a day before the crucial clause V meeting at which the manifesto was to be signed off, he had not seen the final printed version.

Key policies had been thrashed out in discussions, including among the strategy group – but Fisher’s policy team kept a firm hold on the finished document, and his relationship with Milne had been badly frayed by the Brexit battle.

“No one really knew what was coming until it emerged, from a process only really accessible to Andrew Fisher and John McDonnell,” said one Labour source. “And so major policies were coming out – free broadband, Waspi women – which really nobody knew was coming.” But Labour’s policy wonks insist they were just doing what they could to fill the hole where they felt an electoral strategy should have been. Unlike in 2017, policy and strategy were working in silos.

The general election was Fisher’s final job for Corbyn, after he resigned in September, with an email leaked to the Sunday Times in which he gave a blistering critique of Labour’s incompetence, including what he called “a blizzard of lies and excuses” about the party’s failure to come up with a strapline for its conference until the last minute.

The same indecision dogged Labour’s election slogan. “It’s Time for Real Change” was meant as a riposte to Johnson’s phoney claim to be offering a fresh start for Britain, but was the outcome of a fraught debate, including external consultants and focus grouping, and as such was little loved by anyone.

As the campaign went on, and anxiety increased at the risks Labour faced in defensive seats, “Labour Is On Your Side” took over – though one insider laments with hindsight that voters in leave seats who felt the party had betrayed them over Brexit appear to have been moved to respond with “fuck off”.

The “grid”, overseen by the combative Murphy, and discussed at a 10am daily meeting, was packed with policy announcements: but there was scant sense of a theme or direction for each week or phase of the campaign.

“They had all these policies drafted and waiting, and that would lead the grid – a different policy announcement every day,” said one member of the campaign team. “I think it was pretty obvious that there was a lot of throwing a lot of stuff at a lot of walls and hoping it would stick.”

Facebook Twitter Pinterest Corbyn gives a speech to supporters in Whitby, North Yorkshire. The Labour leader failed to win over leave-voting areas. Photograph: Sean Smith/The Guardian

As the campaign went on, and reports flooded into the Victoria HQ from anxious candidates in defensive seats, those who had always believed Brexit was Labour’s overriding challenge felt increasingly vindicated – and alarmed.

On Sunday 24 November, about halfway through, the strategy group met to review how things were going – and agreed it was necessary to make more of a pitch to leavers – and to resource defensive seats more generously.

As a result, Howell recommended adding another 16 seats to the target list, and it was decided to ask Labour’s regional directors for more recommendations – a process that resulted in a further 21 seats being put on the list, taking the total to more than 130, though not all of those were fully resourced.

The group also decided to focus more on Labour’s bread-and-butter offer to working-class voters in leave-supporting communities – including giveaways such as free prescriptions and social care – and to extend the party chairman Ian Lavery’s campaigning Brexit bus tour.

But in the event, much of the following week was overshadowed by Labour’s record on tackling antisemitism. On Tuesday, as the party prepared to launch its race and faith manifesto, the Times splashed with a letter from the chief rabbi, Ephraim Mirvis, claiming Corbyn’s handling of allegations of anti-Jewish racism meant he was “unfit for high office”.

At the Bernie Grant Arts Centre in Tottenham that morning, Corbyn was more than half an hour late for the race and faith event, and the MP Dawn Butler filled the time by reciting the lyrics to the Labi Siffre classic (Something Inside) So Strong, to a bemused audience of hacks, who bombarded Labour aides with questions and requests. Until the last moment, it was unclear whether she and Corbyn would take questions from journalists.

Later that day, the Labour leader recorded a pre-planned interview with Andrew Neil. Corbyn was at his most petulant, as the broadcaster challenged him to apologise over antisemitism, grumpily interjecting “will you let me finish?” – a clip of which found its way on to that week’s Have I Got News for You.

Colleagues say that throughout the campaign Corbyn was keener to be personally involved in day-to-day decisions than in 2017 – and grumpier, sometimes even angry if he felt his views had been disregarded.

Labour tried to use a moment of political theatre to seize back the agenda the next day, by staging a press conference where Corbyn dramatically held aloft a 400-plus page leaked dossier suggesting the government was ready to put the NHS up for sale. “These uncensored documents leave Boris Johnson’s denials in absolute tatters!” he cried.

But the impact was nothing like the furore in 2017 when Labour’s manifesto was leaked – or when Theresa May insisted “nothing has changed”, after executing a swift U-turn on her social care policy. “It worked for a day, and we had a 36-hour row about whether Donald Trump was going to buy the NHS, but that was it,” said one insider.

And as the strategy group tried to hone Labour’s message, focusing on a bread-and-butter offer to leavers, some began to fear Corbyn’s straight-from-the-heart, unscripted authenticity was not the best medium for delivering it. “It’s just Jeremy, isn’t it?” said one exasperated member of the campaign team. “You judge him on a different marking scheme, almost. Did this person in this stump speech hit the five key messages to get on the evening news? No. Was he ever going to? No. I went to rallies where there was a billboard and he didn’t say what was on the fucking billboard. He just talked about whatever he wanted.”

As polling day loomed, some aides would have liked Corbyn to make more aggressive attacks on Johnson, whose loose relationship with the truth was openly laughed at by the Question Time audience when the pair met in a head-to-head debate. But “no personal attacks” was one of the rules written for Corbyn’s 2015 leadership campaign by Fisher, and he stuck to it doggedly.

The Labour leader told the Guardian at the outset of the campaign, “they go low, we go high” – though one despairing party aide described it as “they go low, we go wandering across the country”.

Facebook Twitter Pinterest Members of the media wait outside Labour’s headquarters after the election defeat. Photograph: Henry Nicholls/Reuters

After six gruelling weeks of criss-crossing the country, including a dawn rally in Glasgow on the final day of campaigning, Corbyn watched the grim exit poll with his wife, Laura, his fiercely loyal sons – who released a statement shortly afterwards lambasting the media for treating him badly – and a few officials, including Milne.

They had been on a long journey together, from the political wilderness to the brink of government, but they believed their electoral chances had been crushed, in what one rueful Labour source called, “the Brexit vice”.

“This campaign was lost before it began,” the source added. “Even if nothing had gone wrong in terms of targeting, messaging, Jeremy’s schedule, TV interviews, anything – I still think we would not have won.”