Davis was a leading critic of the plan to increase the possible pre-charge detention time to 42 from 28 days, on which the government narrowly won a parliamentary vote late on Wednesday.

The House of Lords, parliament's second chamber, is expected to vote against the extension.

'British freedom'

"This Sunday is the anniversary of Magna Carta, a document that guarantees the fundamental element of British freedom, habeas corpus. The right not to be imprisoned by the state without charge or reason," Davis said.

"But yesterday this house allowed the state to lock up potentially innocent citizens for up to six weeks without charge."

David Cameron, the Conservative party leader, said he wished Davis well.

"It's a personal decision, a decision he has made. I wish him well," he said.

Nick Clegg, leader of the opposition Liberal Democrats, said that his party would not stand against David in the by-election in the north of England constituency.

Davis will be replaced in his home affairs role by Dominic Grieve, the party's spokesman on legal affairs.