He needed to show that his personal past was not a liability. This he did by increasing his party's share of the vote by 2.8 per cent compared with the 1997 general election.
Second only to the 7.5 per cent rise enjoyed by the Tories two years ago in Uxbridge, this was enough to show that he could win by-election votes as effectively as any other Tory - despite the backdrop of the Archer and Ashcroft revelations. Mr Hague, in contrast, needed to demonstrate his party has a future. But the 4.4 per cent swing from Labour to Conservative will do little to persuade anyone he has a chance of winning the next general election. If repeated nationwide it would still leave Mr Blair with an overall parliamentary majority of about 80. It compares lamentably with the average mid-term by-election swing of 10 per cent in Tory-held seats when the party was last in opposition during the 1974-9 Labour government.
Mr Hague may be invulnerable to a leadership challenge this side of the next election. But after defeat he will not be. Now he faces the reality that the potential pretender to his throne has secured his return to Westminster with a safe seat and political reputation intact. Even this week a MORI poll showed that only half of Tory voters think that Mr Hague is the most capable figure to lead the Conservative Party. Nearly a third opted for Mr Portillo.
Mr Hague might be inclined to take satisfaction from the fact that both the pro-European Tories and the United Kingdom Independence Party saw their vote fall compared with June's European election. But, alas, this could simply indicate that when it comes to domestic elections, Europe cuts less ice with voters and is not quite the automatic vote winner that Mr Hague apparently believes.
The result will have done little, either, to assist the Tory leader's hopes of attracting a first-rank candidate to fill the hole left by Jeffrey Archer's departure. It seems the job of Tory candidate for London mayor has few prospects.
Reflected across London as a whole, the Kensington performance would leave the Conservatives nearly 10 points adrift of Labour. True, with Labour well short of half the vote, the outcome would depend on the second preferences of Liberal Democrat, Green and other voters cast under the new supplementary vote system. But the Tory candidate would need to win over 70 per cent of these to overturn such a deficit. A tall order.
But there is a warning for Labour in the Kensington result too. The six point fall in its support compares unfavourably with its success in holding its own or better in the two previous by-elections in Tory seats, Eddisbury and Beckenham. Doubtless its task was not made any easier by the plethora of candidates in Kensington.
But perhaps it was not helped either by the row about Mr Livingstone's mayoral candidacy. On this performance, a Labour mayoral victory is likely to be secured only with the aid of Lib Dem second preferences. And Labour are unlikely to have a majority in the new Greater London Assembly either. Even Mr Livingstone may find it useful to pursue cordial relations with the Lib Dems, just as the Prime Minister and the Scottish First Minister have done before him.
John Curtice is deputy director, ESRC Centre for Research into Elections and Social Trends