Iain Macwhirter on David Davis

Magna Carta, the Glorious Revolution, Haltemprice and Howden - doesn't have quite the same ring, somehow. The former Tory home affairs spokesman, David Davis, has been ridiculed for resigning his seat in his outrage at the erosion of civil liberties in Britain. He is being cast as a self-indulgent egomaniac, engaging in a meaningless stunt which will undermine his own party. Commentators on right and left have questioned his sanity, condemned his judgement and suspected his motives. About the only thing that hasn't been said about David Davis is that perhaps he might actually be doing the right thing.

Resignation on principle is a noble tradition of British politics, though, granted, it is usually from a position of power that politicians resign - like Robin Cook over Iraq - rather than from a position of no power at all.

But the personal cost could be just as great. Davis has almost certainly ended his front-bench career, and the possibility of becoming home secretary in the next Tory government. Sacrificing his career in this way is a little like those Buddhist monks in Vietnam who set fire to themselves to express their opposition to the war. It's lunacy, but inspired lunacy.

Westminster village people find this utterly mystifying in an age in which every action is assumed to have a personal advancement at its heart. But the British public may respect a politician who - for once - actually believes what he says and has the courage of his convictions. This has clearly not been done out of vanity or political calculation, because a moment's consideration shows that it will damage David Davis more than anyone.

Labour has decided not to stand against him, which does rather betray their own lack of conviction about their counter-terrorism policies.

Gordon Brown seems content to be represented by the former Sun editor, Kelvin MacKenzie, of the "Red Mist Party". Backed by Rupert Murdoch money, he is standing on a "42 days isn't enough" platform.

It is an elegant commentary on the state of Labour that Brown has handed his moral compass to the most rabid tabloid populist in Fleet Street.

No-one I know in the Labour Party supports 42-day detention without trial. The government didn't so much lose the argument as hardly bother to make it.

The logic seemed to be that 69% of the public believes detention without trial is a good thing and therefore it must be right. Gordon Brown, unlike Tony Blair, has not fronted the debate, going out and about meeting his critics. He has hidden away in his bunker as usual, doing dodgy deals with Paisleyite DUP MPs and bribing everyone he could reach on his own benches. This has shown the worst side of Brown's political personality, and confirmed that Labour MPs cannot be relied upon to stand up to the authoritarian state.

Davis is right to say that the government's plans for detention without trial, identity cards and surveillance together represent the greatest assault on the liberties of the individual in Britain for three centuries. Locking people up for six weeks without charge will undermine justice and play into the hands of the terrorists. Freedom from arbitrary arrest is one of our greatest freedoms and it does stem from Magna Carta. The 42-day detention will further antagonise the Muslim communities in Britain - for, let's face it, they are the ones who will be banged up under this law, losing jobs and their houses in the process.

But it's not over. Legal authorities condemn the move, the Lords will throw it out and judges may challenge it in the courts. Davis's resignation will add moral force to the extra-parliamentary rearguard action against the erosion of liberty.

And it may not be so daft politically. A principled action like this on grounds of conscience is exactly what the Cameron Conservatives need to give them some moral authority, broaden their appeal, and efface the memories of the past.

Rather like the independent MP Martin Bell, the man in the white suit who stood against the Hamiltons in 1997, Davis represents a beacon of principle in an age of compromise. Yes, like Bell, he may be vain and slightly ridiculous - but that doesn't mean he can easily be dismissed. Bell was a huge asset to Labour in its war against Tory sleaze and helped lay the ground for the 1997 Labour victory.

To become the government in 2010, the Tories have to demonstrate they are not the nasty authoritarian party of old, but a new political entity with a moral claim to national leadership. This means, like New Labour, they have to appeal to people outside the narrow conservative community. Having the likes of Shirley Williams, the Liberal Democrat peer, and Shami Chakrabarti of Liberty hailing Davis as a champion of human rights is actually a very big plus for the Conservative Party. There is a certain irony in this, since Davis is a right-winger who supports the death penalty and hates Europe, but you don't have to agree with everything he stands for to agree with him on 42-day detention. That would just be tribalism.

I can't see a lot of downside for David Cameron. If Davis crashes and burns, all Cameron will lose is a former leadership rival who has always been a bit of a wild card. If Davis manages to turn this by-election into a genuine campaign against the oppressive state and a reaffirmation of the foundations of liberty, then the Conservatives as a whole will benefit. They will be seen as more than just a public relations exercise.

So Labour glee may be premature. They seem to think the voters are stupid people whose fears can be manipulated to the electoral advantage of the government. But they are not fools, and liberty is in the British cultural DNA. People can see the security cameras going up everywhere - we have more of them than any country in the world, even China.

They can see that identity cards won't work and remember that even Churchill opposed them. The voters may be wary of terrorists, but they can understand how they would feel if they were locked up without charge.

Davis is reawakening a powerful tradition of libertarian individualism that goes back to William Cobbett and beyond. He may be a bit daft, but sometimes it takes a fool to see the emperor's lack of clothes.