Ukip's seemingly relentless electoral advance stalled on Friday after the Conservatives held Newark with a larger than expected majority, partly attributed to people voting tactically to keep Nigel Farage's party out of Westminster.
Robert Jenrick held the Nottinghamshire seat with a majority of 7,403 over Ukip, who at one stage had hoped that coming first in the European elections two weeks earlier would be a springboard to getting an MP elected to the Commons.
Jenrick took 45% of the vote, with Ukip's Roger Helmer on 25.9%. Labour came a clear third, on 17.7%, and the Liberal Democrats had a wretched night – beaten into sixth place by the Greens and an independent hospital campaigner, getting 2.6% of the vote, and losing their deposit for the ninth time in a byelection since 2010.
David Cameron, who took the unprecedented step for a modern prime minister of making four visits to a byelection constituency, said it was a "very good result" for his party.
Even though the Tories had a majority of 16,152 at the general election, and their share of the vote fell nine points in the byelection, there was considerable relief at Conservative campaign headquarters because Ukip has been chalking up better and better results in byelections since 2010.
In the first four byelections of this parliament Ukip came 4th, 2nd, 4th and 5th respectively. In the last four it has come second every time, being beaten by the Lib Dems, Labour and now the Tories.
Farage, who having decided not to stand himself only made one visit to Newark before polling day, predicted a Conservative majority of 2,500 at most and admitted afterwards that Ukip had not done as well as expected.
He was aiming to beat the 27.8% share of the vote Ukip achieved when it came second in Eastleigh, though the share Helmer achieved is still Ukip's second best performance in a byelection.
Farage insisted the result still showed that Ukip was a real threat to the Conservatives. "There'll be an awful lot of Conservatives with a majority of less than 10,000 who will look upon this result tonight in sheer horror," he said.
Cameron is expected to follow the byelection victory with a reshuffle soon, although Tory sources said that this would not be taking place for at least another week.
Although by now well used to byelection disasters, the Lib Dems claimed a new factor had been at play in Newark – tactical voting by people vehemently opposed to Ukip.
"A lot of our supporters felt that the last thing they wanted was to be represented by Ukip in the House of Commons," said Danny Alexander, the Lib Dem chief secretary to the Treasury. "And therefore [there was] a lot of switching to other parties."
Chris Bryant, who was running the Labour campaign in Newark, said all the party's canvassers in the constituency encountered people saying they would be voting Tory just to keep Ukip out. However, that was only one part of a complex pattern of switching taking place, Bryant said.
"There were also Lib Dems who were so cross with the party they were voting Labour; Lib Dems who voted Lib Dem because they did not like the two main parties, and who are now voting Ukip; and Labour supporters who wanted to give the coalition a kicking who were voting Ukip," he said.
George Osborne, the chancellor, said the result was "disastrous" for Labour because it won Newark in 1997. Bryant said that comparison was unfair, because boundary changes since then had made it a much safer seat for the Tories, adding that he was happy with the result.
But John Curtice, a leading psephologist, said that Labour should have been "on tenterhooks" as to whether they could have taken the seat. A swing of 15.8% from the Tories to Labour – less than the 16.5% swing the Tories achieved in Norwich North in 2009 – would have seen Labour win, he pointed out.
guardian.co.uk © Guardian News and Media Limited 2010