Many have said in recent weeks that Conservative leader David Cameron must have been kicking himself for allowing Nick Clegg, leader of the Liberal Democrats, to join the leader's debates in the run up to the campaign. However as the Lib Dem surge spurred on by "Cleggmania" proved to be an illusion, what Mr Cameron should really regret is his decision not to hold a referendum on the Lisbon Treaty as UKIP may have cost him his majority.

A careful look at the results of yesterdays election shows that UKIP voters could have cost Mr Cameron as many as 21 seats. Had the Tories secured those seats their total number of MPs would have reached 326, a majority of one. Instead they face the prospect of a minority government, a coalition with the Lib Dems or even opposition against a Lib-Lab pact.

Five years ago when Mr Cameron became leader of the Conservatives, he embarked on a mission to modernise the party, which at the time was seen as being obsessed with Europe and immigration and was, in the words of one Shadow Cabinet member, regarded as the "nasty party".

The modernisation process saw the party engage with more issues such as climate change and social justice. However the party also started to go against some of the traditional values of its followers, by supporting laws against the introduction of grammar schools and by appearing to be more politically correct by backing government equality laws.

Many traditional conservatives were shocked and disappointed when, late last year, Mr Cameron decided he would not be sticking to a "cast-iron" promise to hold a referendum on the controversial Lisbon Treaty, once it had been ratified.

The move, together with some of his other previous actions signalling a drifting from conservative principles, undoubtedly sent many Tory voters into the arms of UKIP, the anti-EU, pro-grammar school, anti-political correctness and climate change sceptic party, whose members and candidates are largely disaffected Tories (the last four UKIP leaders are all ex-Tory members or activists).

UKIP failed to win any seats at this election, indeed even their high flying former leader Nigel Farage, failed to seriously threaten the majority John Bercow, Speaker of the House of Commons in Buckingham.

However in 15 seats that were taken or held by Labour, and six taken or held by the Lib Dems, the Tories would have won if those voting UKIP had supported the Tories, suggesting a tougher line on the EU in the form of a promise of a referendum on Lisbon, or on membership of the EU itself, might have swung it for the Tories.

In many of the seats, such as in Hampstead & Kilburn (Labour hold) and Solihull (Lib Dem gain from Conservatives) the Tories lost by only a whisker while UKIP polled a few thousand votes which could have turned the tide.

Had UKIP voted with the Tories it would also have provided them with their much desired "Balls moment" in Morley & Outwood and would have removed Transport minister Sadiq Khan in Tooting and Glenda Jackson in Hampstead and Kilburn.

More importantly it would have just given the Tories a majority. The final election results on Friday are 305 Conservative seats, 258 for Labour and 57 for the Lib Dems.

Had the Tories adopted a policy on Europe that could attract UKIP voters they could have gained 15 seats from Labour and six from the Lib Dems. This would have changed the result to 326 Conservative seats, 243 Labour and 51 Lib Dem - a Tory majority.

When Mr Cameron set about his modernising mission it was believed he might alienate some of his traditional voters but would gain the middle ground. Today's results suggest the first part of the strategy may have worked but the second has been found wanting.