David Cameron can barely believe his luck. Britain's trade unions have just installed Ed Miliband as leader of the Labour party, allowing the Tories to portray him as the plaything of the unions.

The prime minister had thought the Labour party would elect David Miliband for the simple reason that he was the most popular candidate among the wider electorate.

In a sense Cameron was right. David Miliband was elected by the parliamentary Labour party and by constituency Labour parties. He won these sections of the electoral college even after the transfer of votes from the other candidates.

Ed Miliband swung the leadership because he built up an overwhelming level of support among trade union members. Their votes just carried him over the finishing line by 1.3 percentage points.

Shortly after Ed Miliband's election this afternoon, the prime minister issued a friendly statement congratulating him. They are chatting on the phone this evening.

But Lady Warsi, the Tory chair, issued a statement saying what the party really thinks:

Ed Miliband wasn't the choice of his MPs, wasn't the choice of Labour party members but was put into power by union votes. I'm afraid this looks like a leap backwards for the Labour party.

The Tory line of attack shows that Ed Miliband will need, as a matter or urgency, to show the unions can expect no favours under his leadership.

In a sense Ed Miliband will feel he does not need to say anything. He does not believe for a moment that there should be a return to the "beer and sandwiches" era of the 1960s and 1970s when the likes of the mighty Jack Jones enjoyed privileged status.

But the quick and sharp attacks from the Tories this evening show Downing Street wants to create the impression that Ed Miliband is dependent on the unions.

Perhaps the new Labour leader might take out a leaf out of the book of his strong supporter and hero of the Labour movement, Neil Kinnock. Having hailed from the left, Kinnock then upset the left as he embarked on the long route to electoral success.