When Jeremy Corbyn made the Labour leadership ballot with two minutes to spare on 15 June, few believed that he would play a defining role in the race. The 66-year-old socialist ran in the expectation of influencing the contest, not winning it. After taking much persuading to stand, the Islington North MP explained: “Diane [Abbott] and John [McDonnell] have done it before, so it was my turn”. On the day that Corbyn made the ballot, a shadow cabinet minister recalled Abbott’s last-place finish in 2010 and derided his chances to me.

Those who nominated the perpetual backbencher fell into three categories: fellow left-wingers such as John McDonnell and Jon Trickett who backed him out of ideological principle, soft-left figures including Jon Cruddas and Sadiq Khan who wanted to ensure a “broad debate”, and opponents like Frank Field, who hoped that Corbyn’s defeat would strengthen the right. None of these groups believed he could win.

There were early signs that Corbyn’s candidacy should be taken seriously. Simon Fletcher, Ken Livingstone’s former chief of staff, was appointed as his campaign director. Fletcher, who served as Ed Miliband’s trade union liaison officer, is admired for his strategic nous and organisational skills even by those who do not share his left-wing politics. On 5 July, Corbyn won the endorsement of Unite, the UK’s largest trade union and Labour’s biggest affiliate, which nominated Ed Miliband in 2010.

Then, on 15 July, my New Statesman colleague Stephen Bush revealed private polling showing the Corbyn on course to win the contest. The story was dismissed by many as unreliable. A week later, it was vindicated. The first poll of the Labour selectorate, by YouGov, showed Corbyn 17 points ahead of his nearest rival, Andy Burnham (43-26), in the initial round of voting. Under the party’s preferential electoral system, Corbyn would ultimately triumph over the shadow health secretary by 53-47. A candidate who was regarded by almost all, including himself, as a mere token could soon become leader of the opposition.

“What has happened to the party?” asked one shadow cabinet minister, capturing the mood of incredulity and panic at the top of Labour. Having voted for David Miliband in 2010, members appear poised to elect one of the most left-wing MPs in parliament, who has rebelled 534 times against the leadership since 1997.

There are important caveats to the YouGov poll. After the general election debacle, all surveys should be handled with caution. Polls of party members are always problematic, owing to the difficulty of achieving a representative sample, and YouGov president Peter Kellner says this one “should be regarded as a grainy photograph of the Grand National with half the race still to run”.

But that Corbyn has surpassed all expectations is undeniable. The question being asked in Labour circles is why. One shadow cabinet minister attributes his surge to a party that is “in grief”, “in shock” and “going through a nervous breakdown”. To those members traumatised by Labour’s defeat, Corbyn offers the greatest source of comfort. After the election, his rival candidates (Burnham, Yvette Cooper and Liz Kendall) all positioned themselves to Miliband’s right. Only Corbyn advanced the soothing argument that Labour lost because it was insufficiently socialist. The success of parties to its left in Scotland, Greece and Spain has given his views a salience they previously lacked. A Labour source also blames Miliband’s accommodatory leadership. “The left of the party has been indulged for five years and hasn’t been challenged,” he said.

As the only anti-austerity and anti-Trident candidate, Corbyn has benefited from his ideological distinctiveness. To his supporters, what unites Burnham, Cooper and Kendall is more important than what divides them. They all offer variations on the same uninspiring centrist brew. None resembles a prime minister-in-waiting. The improbability of the next leader reaching Downing Street explains why some members have seized the chance of a “free hit” as Chuka Umunna recently described it to me. But many, in any case, regard winning elections as a third-order issue. The YouGov poll found that only 27 per cent of party members believed it was important that the leader “understood what it takes to win”, compared to 53 per cent who wanted someone who could provide an effective opposition and 62 per cent who wanted a leader in touch with the concerns of ordinary people.

Should Corbyn win, he will have Unite to thank. It was the trade union’s activities in Falkirk that prompted Miliband to introduce Labour’s one-member-one-vote system. Under this model, MPs have lost their “golden share”, which gave them a third of the votes in the electoral college. The anti-Corbyn Parliamentary Labour Party is unable to counter the thousands of left-wing activists (and Machiavellian Tories) signing up to support him.

Corbyn’s rivals have been asked whether he could serve in their shadow cabinet. The question now is whether they would serve in his. Shadow cabinet ministers told me that almost all current members would resign rather than join Corbyn’s team. MPs privately predict that he will be ousted “before Christmas” if he wins.

Senior figures hope the matter will not arise. The poll could be the moment that Labour members conclude that the dangers of voting Corbyn are too great. Yet it could equally galvanise even more into signing up to guarantee his victory.

Wherever Corbyn finishes, the left of the party will be stronger than at any point since his election in 1983. To many, it feels as if Labour has regressed several decades in the space of a few weeks. The journey back to reality, they fear, will take much longer.