Senior Tory David Davis has announced he is to resign as an MP and fight a by-election in his seat on the issue of detention of terrorist suspects.

He has also stepped down as Shadow Home Secretary.

Yesterday the House of Commons narrowly voted in favour of extending the maximum period of pre-charge detention for terrorist suspects from 28 to 42 days.

Mr Davis shocked political observers and colleagues by announcing today that he will resign his Haltemprice and Howden seat, forcing a by-election.

“I will argue in this by-election against the slow strangulation of fundamental British freedoms by this government,” he said.

Mr Davis is seen as more right-wing than David Cameron, who defeated him in the contest for the Conservative leadership in 2005.

The move is extraordinary but not unprecedented.

In 1985 Unionist MPs resigned en masse in protest at the Anglo-Irish Agreement signed by then-Prime Minister Margaret Thatcher and contested their seats at the subsequent by-elections.

David Cameron, leader of the Conservative party, was informed of Mr Davis’ decision last night and denied there was a rift between them.

“It was a personal decision, a decision he has made,” he said.

Mr Cameron said he would campaign for Mr Davis in the by-election. He has appointed Dominic Grieve as the new Shadow Home Secretary.

Lib Dem leader Nick Clegg, whose party also opposed the extension to 42 days, said they would not run against Mr Davis in the by-election.

Mr Davis, 59, has been an MP since 1987.

Since Labour came to power he has voted against the equalisation of consent, the abolition of Section 28 and the rights of gay couples to adopt.

He was absent from votes on civil partnerships.

Mr Davis was also absent from a more recent gay rights vote when Tory MPs forced a division in the House of Commons on the Sexual Orientation Regulations.

During his campaign for the party leadership, Mr Davis told journalists that as a teenager he intervened in the intimidation of a gay pupil by a gang of bullies at his inner London school.

In an interview with the Daily Telegraph last year Mr Davis claimed to be a social liberal.

“People think I’m traditional but I gave away a gay friend at his civil partnership ceremony the other day,” he said.

“In a perfect world everybody would understand absolutely what I stand for.”

MPs cannot actually resign from the House of Commons.

Instead they must apply to the Chancellor of the Exchequer for one of two sinecure positions, Bailiff of the Chiltern Hundreds or Steward of the Manor of Northstead.

By taking up these appointments they become a paid agent of the Crown and therefore cannot remain in the Commons.

No Chancellor has refused such a request since the 19th century.

To see the full text of Mr Davis’ resignation speech click here.