Gordon Brown has intervened in the Labour leadership contest with a warning that the party will be powerless to help the poorest and most vulnerable in society unless it can win a general election.

In a high-profile 50-minute speech in London he did not mention left-wing frontrunner Jeremy Corbyn - viewed as unelectable by many Labour MPs - but warned of the consequences of retreating to becoming a "party of protest".

The former prime minister said the party must learn from its history that only by being elected has it been able to implement Labour policies.

He acknowledged the party was "grieving" after its general election defeat, but said: "There is one thing worse than having broken hearts, it is powerlessness.

"Our hearts can be broken and yet it is worse to find out we are powerless to do anything about it. To see a wrong and not be able to right it, to see an injustice and not be able to correct it, to see suffering and be able to do nothing about it, to see pain and know you cannot heal it, to see good that needs to be done and change that needs to be made and not to be in a position to do it.

"When I know, and I argued, and I think you believe, that the only way that we can avert the pain and end the suffering is by securing in the future the election of a Labour government to deliver on our priorities.

"And when I see the opinion polls that say the one grouping in the party that is likely to get most votes is the one grouping that even its own supporters say is least likely to be able to form a government, then we have to look at the lessons of our history."

Mr Brown, who did not refer to any of the four leadership candidates by name during his speech, refused to comment on who he would vote for in the contest.

But in an a clear indication he was warning about the impact of a victory for Mr Corbyn, he singled out some of the would-be leader's potential foreign allies.

He said the rise in popularity of non-establishment politics was a response to the insecurity created by globalisation.

Mr Brown said: "If we are going to solve the problems of both the global economy, global finance, global climate change, if we are going to solve the problems of global inequality and poverty, we will need a level of global co-operation to match our national endeavours that is higher, and at a far more sustained and advance level, than ever before.

"And I have to say, if our global alliances are going to be alliances with Hezbollah and Hamas and Hugo Chavez's Venezuela and Vladimir Putin's Russia, there is no chance of building a worldwide alliance that could deal with poverty and inequality and climate change and financial instability."

In an apparent reference to Mr Corbyn's refusal to rule out campaigning for a British exit from the European Union, Mr Brown added: "How can we say that for progressives the best way of facing the future is to abandon co-operation with Europe, to leave our membership of the European Union just at the time when our leadership is needed more than ever to fight protectionism and xenophobic isolationism and all the extremes of racism, discrimination and prejudice?"

With ballot papers for the contest arriving and voting beginning in the coming days, Mr Brown said the party had to offer "hope" to the public that it could be an alternative government.

"I believe that our vote is both a public duty and a sacred trust. It is a public duty because we have got to show that the Labour Party can be at the service of the country and that we can change society for the better in the future.

"It is not a vote just for the Labour Party, it is a vote for what kind of country we want to see and what kind of country we want to build."

The speech was delivered in the symbolic Royal Festival Hall on London's South Bank, scene of the victory party that greeted New Labour's 1997 landslide.

In a reminder of the need for electoral success, Mr Brown said: "Remember that we seek power for a purpose. We seek power out of principle. But we cannot win power if we do not win the people."

Mr Corbyn's camp insisted he was the candidate "most likely to engage with voters beyond Labour's existing supporters" and credibility did not mean signing up to austerity.

A spokesman said: "Gordon Brown has highlighted the need for a Labour Party that stands for hope, that is credible, radical and electable - on which basis the best candidate to vote for is Jeremy Corbyn.

"It is necessary to be credible but credibility cannot mean an orthodoxy of austerity that chokes off recovery - instead we need a Labour Party that stands for growth, investment and innovation across the whole country.

"Jeremy Corbyn's clear plans for growth-led recovery rather than austerity mark him out as the candidate offering hope and drawing in thousands of new people in the process. Polls vary but most have shown that Jeremy Corbyn is the candidate most likely to engage with voters beyond Labour's existing supporters.

"Whoever wins this leadership election will have a massive direct personal mandate and that is a powerful springboard for winning in 2020."