ON A sunny afternoon in the garden of the Bristol Flyer pub, a gang of Jeremy Corbyn fans are gathered around a table discussing the Labour Party leader’s rally in the city the day before. “Three thousand people? Was that it?” asks one. “Yeah, you think Corbyn and you think 500,000!” replies a man in a Ramones T-shirt. Still, on to the next battle. Leaflets are circulated, which cheer on Labour’s leader and attack Tories and Blairites. Yet these Corbynistas are not Labour supporters. They are members of a rival outfit: the tiny Socialist Party.

Since he won Labour’s leadership contest last September, Mr Corbyn and his once tiny band of allies on the party’s hard left have taken control of Labour. Partly this is the product of an effort by gnarled agitators from outside it to flood the party with activists and challenge the moderates in its institutions. But it is also thanks to a mostly unorchestrated surge of previously disillusioned new members, many of them young, into the party.

A new leadership contest, triggered after a vote of no confidence in Mr Corbyn by moderate MPs in June, illustrates the transformation. Mr Corbyn deserves to flop. In the past 11 months Labour has lost seats in local elections, failed to hold the government to account, become infected with anti-Semitism, tumbled in the polls and, thanks to its lacklustre campaign to Remain, contributed to Britain’s vote for Brexit. Following the referendum, most of Mr Corbyn’s shadow cabinet resigned. Despite all this, he is heading for a solid win in the leadership contest over Owen Smith, the moderates’ actually-quite-left-wing candidate, on September 24th. This week a court ruled that the 130,000 Labour members who have signed up since January should be allowed to vote in the contest, making Mr Corbyn’s victory all but certain.

How did the formidable centrist party of Tony Blair end up in the hands of Mr Corbyn, an admirer of Hugo Chávez? Entryism has played a part. Mr Corbyn’s victory brought back veterans of Labour’s battles in the 1980s, when Militant, a Marxist group, tried to take over the party. One trouper of the hard left, Jon Lansman, now runs Momentum, a powerful Corbynite movement. Its local groups have come to dominate many local Labour branches and chivvy MPs to support Mr Corbyn. On August 10th Tom Watson, Labour’s deputy leader, alleged that the party was being infiltrated by Trotskyists from groups like the Socialist Party (whose website boasts of its members addressing Momentum events). Some in Momentum want to reinstate “mandatory reselection”, enabling local members to boot out sitting Labour MPs.

Momentum’s efforts are intertwined with those of far-left parties such as the Socialist Workers Party (SWP). John Ferrett, who leads Labour’s group on Portsmouth Council, describes how things have changed: “[Party] meetings used to be friendly and focused on local politics and local campaigning. Now they are dominated by Momentum activists. Most moderate members no longer turn up and those that do get harangued if they criticise Corbyn.” Most astonishing “is seeing the Socialist Worker [the SWP’s paper] being sold outside and inside the meeting.”

The takeover is mirrored at the national level. The National Policy Forum, a policymaking body created by Mr Blair, has been sidelined in favour of the National Executive Committee (NEC), which has tilted left; at elections on August 8th all six of the seats reserved for constituency representatives went to Corbynistas, who now fill 16 of its 33 places. A document circulated by Mr Lansman in December (titled “Taking control of the party”) proposed giving the NEC a veto on candidate selections. If he is re-elected, Mr Corbyn is expected to purge the party’s headquarters, dumping Iain McNicol, its moderate general secretary. Yet Labour’s transformation owes as much to circumstance as conspiracy. The conditions for Mr Corbyn’s victory were ripe: years of austerity concentrated on the young, an outgoing leader (Ed Miliband) whose compromises with electability had failed to save Labour from electoral disappointment and, crucially, new rules enabling non-members to vote in the leadership contest for £3 ($4). Idealistic lefties poured in, tripling the party’s electorate and propelling Mr Corbyn, initially a no-hoper, to a crushing victory. Some of the new joiners are former members who quit during the Blair years. Others are young folk with no experience of party politics. But only a minority, albeit a well organised one, are entryists. Most are simply attracted to the man’s unvarnished style and uncompromising politics. That is evident on his Facebook page (which has more “likes” than that of Labour itself) and at his rallies. In Bristol speakers excoriated Thangam Debbonaire, a local Labour MP who had criticised Mr Corbyn, to cries of “Deselect!” from the crowd. This points to a hard truth for Labour moderates: the party’s metamorphosis is as much a bottom-up swell of enthusiasm as a takeover at the top. Without “the movement”, the top-down changes would be unthinkable. The mass of new members protects Mr Corbyn and forces those who want to make their way in the party to bow to him: of three Labour mayoral candidates selected on August 9th and 10th, one (Steve Rotheram, the unexpected winner in Liverpool) is a Corbyn ally and another (Andy Burnham in Manchester) is a moderate who has pandered to Corbynistas. As long as he has this large, growing base Mr Corbyn can face down his MPs and continue remaking the party for as long as it pleases him.

This is excellent news for the Tories, who are contemplating calling an early election to cash in their poll lead (14 points, according to the latest YouGov survey). And it leaves Labour’s moderates—who remain a large minority of the membership and dominate the parliamentary party—with a grim dilemma. Some are toying with declaring independence from Mr Corbyn and sitting as a separate parliamentary group. But Labour is a tribal party and most MPs are inclined to dig in. They are in for a long wait.