Ed Miliband pledged today to learn lessons from Labour's shock by-election defeat in Bradford West.

The party lost its grip on the constituency after Respect MP George Galloway swept to victory with a majority of more than 10,000.

The Labour leader said today: "It was an incredibly disappointing result for Labour in Bradford West and I am determined that we learn lessons of what happened.

"I'm going to lead that. I'm going to be going back to the constituency in the coming weeks to talk to people there about why this result happened.

"Clearly there were local factors, but I also say only four out of 10 people voted for the three mainstream political parties.

"We've got to understand the reasons why that happened in Bradford.

"Above all it reinforces for me something that I've emphasised throughout my leadership which is that we need to be engaged and rooted in every community of this country.

"We need to show to people that our politics, that Labour politics, can make a difference to people's lives."

Labour was predicted to hold on to the seat, but Mr Galloway, an ex-Labour MP, won 18,341 votes to the 8,201 for Labour candidate Imran Hussain.

The contest was sparked by the resignation due to ill-health of Marsha Singh.

Turnout in the poll was just over 50% - considered high for such an election, especially in an urban area.

As he did in the 2005 general election, when he dramatically swiped an east London seat from his former party, Mr Galloway targeted the votes of a large Asian community.

Celebrating his victory, he told Sky News last night: "It is a very comprehensive defeat for New Labour, it is a pathetic performance by the Government parties.

"The big three political parties have had a very salutary, unkind lesson this evening and I hope that they all take note.

"The people of Bradford have spoken this evening for people in inner cities everywhere in the United Kingdom."

The Conservatives polled 2,746 votes, suffering a swing of 22.78%, but party chairman Baroness Sayeeda Warsi attacked Mr Miliband for failing to capitalise on the Government's recent difficulties over a potential strike by fuel tanker drivers, the furore over the so-called pasty tax and the "cash for access" row.

Baroness Warsi said: "If Labour can't win one of their safe seats in these tough economic times and in a tough week for the Government, how can they win anywhere?

"Not in half a century has an Opposition come back from such an appalling result to win a majority at the next general election.

"This tells you everything you need to know about Ed Miliband's weak leadership."