By Iain Watson
Political correspondent, BBC News
The result was never in doubt. Some of the bookies had even stopped taking bets on a David Davis victory before the polling booths opened in the Haltemprice and Howden constituency.
But in an otherwise overheated leisure centre, where the ballot boxes were being opened and the contents counted, a chill must have rippled down the spine of his supporters when a recount was announced and the expected declaration time came and went.
A record-breaking 26 candidates stood in this by-election
In the end, it was a run-off for second and third place, with the Greens edging out the English Democrats - who had made opposition to the EU treaty the main issue of their campaign.
But for Mr Davis this by-election was all about opposition to Big Brother. Sadly, not opposition to the Channel 4 reality show of that name, but against what he sees as an overly intrusive state.
He railed against too many CCTV cameras which, he said, were largely ineffective, and a DNA database in the hands of the police but containing the details of a million people who do not have criminal records.
And there was the issue that sparked the by-election in the first place: the detention of terrorist suspects for up to 42 days.
Mr Davis resigned his seat last month when the government narrowly pushed the measure through the Commons, with the help of nine Democratic Unionist MPs.
HAVE YOUR SAY
What has the David Davis by-election result achieved? Absolutely nothing!
But the former shadow home secretary had his sanity, if not his commitment, called into question privately by some in his own party. After all, they argued, the House of Lords was likely to reject the 42-days proposal, so why resign?
Labour refused to take part in the by-election, denouncing it as a stunt both before and after the result. The Liberal Democrats abandoned the fray by saying they were in agreement with Mr Davis when it came to defending civil liberties.
So without heavyweight opposition, and with rumblings from some fellow Tories - though his leader stuck to his promise and came to the constituency to campaign for him - he needed to silence his critics by motivating enough people to vote in an election that was seen as a foregone conclusion.
Turnout was 34%, which gave Mr Davis his dignity. It was well short of the 50% turnout recently in the Henley by-election and the 58% at the hard-fought Crewe and Nantwich contest, where all three main parties took part.
But it was well ahead of the 19% turnout in the Labour heartland of Leeds central at the 1999 by-election, two years into a popular first term for the government.
Indeed, some people said they had turned out to vote for Mr Davis not because they agree with him on policy, but because they agree that politicians should make a stand and pursue what they believe.
But it was not just Labour which called this by-election unnecessary. One of the candidates - the appropriately named Herbert Crossman - told me that Mr Davis, and not the taxpayer, should pick up the bill for the by-election.
Mr Crossman garnered only 11 votes.
He was one of 23 candidates who lost their £500 deposit for achieving less than 5% of the vote.
With two of the main parties opting out, a record number of candidates entered the electoral battle - 26 in all, producing the longest and largest ballot paper seen at a by-election.
Few candidates felt obliged to stick to the specific civil liberties issues Mr Davis had said he wanted to debate.
We had candidates who were for and against the smoking ban; who wanted population control; who opposed the EU treaty or called for a referendum on it - a key plank of the Christian Party's platform.
But two smaller parties did take direct issue with Mr Davis.
"I may be a loony but I'm not mad enough to want dangerous people to be walking the streets," was Mad Cow Girl's view on the 42-day debate. She represented the Monster Raving Loony Party.
Miss Great Britain would not be confused with Mad Cow Girl by even the most casual observer, but there were some similarities between these candidates. The beauty queen did not just lose her deposit, but also her temper when challenged on her support for the anti terror-legislation, as she waited for the votes to be counted.
Miss Great Britain congratulates Mr Davis on winning
She declared herself "happy to be locked up for 42 days if I am a suspect".
Mr Davis praised his opponents, telling me that English - or in the case of Miss Great Britain, Northern Irish - eccentricity was the very essence of British democracy.
I am sure he did not count himself among that group, but equally he did not think what he called a "spectacular victory" would propel him back on to the Conservative front bench either.
Perhaps he was being coy, but he said after the count he had not received a call from Conservative leader David Cameron, and would be happy to continue to fight the 42-day detention proposals from the backbenches.
"When I went into this I knew I was risking not just my shadow cabinet position but possibly my cabinet career," he said, suggesting he did not expect preferment even if the Conservatives won the next election.
So while he won the by-election, and continues to argue the debate on 42 days, Mr Davis may have lost his position in the front rank of British politics for the foreseeable future.