Image copyright PA Image caption John McDonnell, right, with Jeremy Corbyn in 2001

Left-winger John McDonnell has been appointed shadow chancellor by his close friend Jeremy Corbyn. Here is a look at his background and politics.

Twice he has tried to stand for Labour leader and twice he failed to get enough backing from MPs to make it onto the ballot paper.

Partly that was the fault of circumstances, but partly it also reflected the fact that McDonnell, at 64 two years younger than his new leader, is seen as a more divisive figure than Corbyn.

This time around he persuaded his close friend to stand and instead masterminded the campaign which took the 200-1 outsider to stunning victory.

Image copyright Getty Images Image caption McDonnell masterminded a Corbyn campaign which drew big crowds

His reward has been to get what is generally regarded as the second most important role in a political party - in charge of economic policy and taking on Chancellor George Osborne.

It is all a big change from 2007 when our profile of him began: "Left-wing leadership candidate John McDonnell is the sort of MP who used to give Labour leaders a double dose of the jitters. However, that was back in the 1980s and early 1990s when the hard left, particularly the Militant tendency, were a real force in the Labour movement."

Now it's other members of the party, rather than the leader, getting the jitters - BBC political editor Laura Kuenssberg says members of Corbyn's own team warned him not to give the role to McDonnell, because of the impact it would have on the rest of his senior team.

Public spending cuts

The man now in charge of Labour's economic strategy is certainly not one to have minced his words over the years.

His Who's Who entry talks of "generally fermenting the overthrow of capitalism", and as BBC business editor Kamal Ahmed notes, he has argued in the past for the nationalisation of the UK's banking system, a rapid expansion of public ownership and a new 60% tax rate for earnings over £100,000.

He says he is not a deficit denier. In his blog post last month McDonnell says: "We accept that cuts in public spending will help eliminate the deficit, but our cuts won't be to the middle-and low-income earners and certainly not to the poor. Our cuts will be to the subsidies paid to landlords milking the housing benefit system, to the £93bn in subsidies to corporations, and to employers exploiting workers with low wages and leaving the rest of us to pick up the tab."

As BBC economics editor Robert Peston says, McDonnell is unambiguous that "we believe that we can tackle the deficit by halting the tax cuts to the very rich and to corporations, by making sure they pay their taxes, and by investing in the housing and infrastructure a modern economy needs to get people back to work in good jobs".

Like Corbyn, McDonnell has a long history of left-wing politics in London.

He has been involved in Hayes and Harlington for more than three decades - including a spell as deputy leader of the Greater London Council to Ken Livingstone and as chair of finance overseeing its £3bn budget.

He referred to this when asked on his first morning as shadow chancellor about his suitability for the job - pointing out that he was "chancellor of the exchequer for London at the age of 29".

The married father of three, who suffered a heart attack two years ago, was born in Liverpool, but was educated at Great Yarmouth Grammar School and Burnley Technical College.

Backbench rebel

McDonnell, whose first marriage ended in 1987 and who remarried in 1995, spent time after leaving school as a production worker, and according to the Evening Standard attended night school to take his A-Levels before going on to study government and politics at Brunel University.

He then became an official for the National Union of Mineworkers and TUC and completed a masters degree at Birkbeck College in London.

He stood for Parliament in 1992, losing by just 54 votes but campaigned for the next five years in the seat, being elected in Tony Blair's landslide victory by 14,291 votes.

During the New Labour years he was chairman of the Campaign Group of socialist Labour MPs - a fairly small band who rebelled on a regular basis - on issues ranging from the Iraq War and tuition fees to ID cards and fast food firm McDonald's sponsorship at Labour's 2001 conference.

There were controversies along the way - in 2003 he told a gathering to commemorate the IRA hunger striker Bobby Sands: "It's about time we started honouring those people involved in the armed struggle. It was bombs and bullets and sacrifice made by the likes of Bobby Sands that brought Britain to the negotiating table."

In 2010 McDonnell had to apologise for saying during a radio warm-up that if he could go back in time he would "assassinate Thatcher" - with Jeremy Corbyn taking part in the debate about the comments on the Daily Politics:

A year earlier he was suspended from the House of Commons for five days after grabbing the mace - the ornamental club which represents the royal authority of Parliament - during angry exchanges over Gordon Brown's Labour government's decision to approve a third runway at Heathrow.

Earlier this year, as he rebelled against the Labour leadership on the Welfare Reform Bill, he said: "I would swim through vomit to vote against this bill. And listening to some of the nauseating speeches in support of it, I might have to."

That was the latest of what have been many, many rebellions over the years. It will also, presumably, be the last for at least a while as he prepares to make his move from backbench critic to the front bench.