AT FIRST Nigel Farage seemed unwelcome in Rotherham. The leader of the populist UK Independence Party (UKIP) was visiting the hilly Yorkshire town on February 6th to open its campaign headquarters there, but was now trapped inside it. Protesters had gathered outside the front door, chanting and brandishing placards accusing UKIP of bigotry. Passing cars and vans honked, to cheers.

But it soon became clear that the horns, and many residents of the town, were for UKIP. “Wankers!” yelled one van driver at the crowd. The owner of a neighbouring military-surplus shop looked on, bemused. “He’s a tit and talks out of his arse,” he said of Mr Farage. “But I’m voting for him.” Arm-in-arm, a passing elderly couple chided the protesters.

Opinion polls suggest that one in five Britons could vote for UKIP in the general election on May 7th. Though hugely disadvantaged by the first-past-the-post electoral system, the party could win a handful of seats. By taking Conservative votes in up to 100 others, it could also deny that party a second term. Yet the drama in Rotherham also hinted at a bigger future for UKIP. Long a party of the Tory south of England, it is increasingly one of the Labour north, too (see map). That shift has big implications for its character and prospects.

The southern third of Britain’s east coast is generally considered UKIP’s heartland (pushing the point, a Labour politician says it does well where there is good fish and chips). It has picked up dozens of local-government seats there since 2012 and will probably take at least two district councils, one in Kent and one in Essex, in May. Its two elected MPs, Douglas Carswell and Mark Reckless, defectors from the Conservative party, both won by-elections in the south-east last autumn. In May Mr Farage could well join them as MP for South Thanet, on the eastern tip of Kent. Margate, a faded seaside resort in the neighbouring seat of North Thanet, shows why the nostalgic party does so well in such places. On the seafront, paint peels off the boarding houses where Victorians once summered. Now divided into cheap flats, many house Poles and Latvians who work as cleaners or at Thanet Earth, a nearby complex of greenhouses. Locals who have lived in the area for decades feel “pissed off and alone”, says Chris Wells, a Tory councillor who defected to UKIP last October. Many of these “bungalow Tories”, working-class folk who voted for Margaret Thatcher, are attracted by the party’s small-state message and its warnings about the economic impact of immigration, he says. Yet, far from the Kent coast, another UKIP heartland is emerging in northern towns hobbled by the decline of traditional industries such as coal and steel. If Mr Wells sounds like a traditional Tory politician, Jane Collins, the party’s candidate in Rotherham, sounds like a Labour one. As MP, she pledges, she would focus on “social cohesion”. Perched next to her on a sofa in his party’s besieged office, Mr Farage reels off a list of northern by-elections in which his party has recently come second: South Shields, Barnsley Central, Middlesbrough. All are places neglected by Labour and where UKIP alone speaks to voters’ gut instincts, he claims. Some of them have well-established Asian Muslim minorities that remain semi-detached from their white residents—so concerns about immigration there are more cultural than economic. The revelation that perhaps 1,400 girls were abused by mostly Asian men is fuelling UKIP’s rise in Rotherham (its recent advertising posters read: “There are 1,400 reasons why you should not trust Labour again”). But even there the party will not win in May. Mr Farage is doing something British political leaders rarely do: thinking beyond the next election. Matthew Goodwin, the co-author of a book on UKIP, says its strategy is to come second in some 50 or 60 northern Labour seats this May and thus be in a position to win them at the next general election. That explains why, though its most immediately promising constituencies are southern, UKIP held its annual conference last year in Doncaster and why Mr Farage will spend much of the election campaign touring the north.

In the long term, UKIP’s prospects may be best there. Voters who switch from Labour to the party generally remain more loyal to it than do former Tories, observes Mr Goodwin. And as the main anti-Labour force in places like Rotherham it will face little competition. The Tories are electorally toxic and organisationally moribund there; and the Liberal Democrats have been tainted by association with them. If May’s election produces an unstable Labour government, Mr Farage’s party will stand a decent chance of sweeping to victory across the urban north in 2020.

The success or failure of his strategy is bound to influence UKIP’s ideological direction. A party rooted in economically leftish constituencies where immigration is mainly a cultural issue will be markedly more statist and authoritarian than one rooted in coastal, Toryish seats where it is not—probably excessively so, for some libertarian, pro-market types in UKIP. Tilting northward could leave Mr Farage more powerful than ever, but with a fractious, divided party.