David Cameron speaks about the riots at a youth centre in his constituency in Witney. Photograph: Wpa Pool/Getty Images

The political aftermath of such shattering events as last week's riots is a messy business. It is not just their shocking nature. These events exposed some of the limits of power. Politicians, accustomed to dealing with elites, have to re-establish their grip on power while recognising how close they came to losing it. On Monday morning both David Cameron and Ed Miliband were talking about ordinary people caught up in extraordinary events and the way they did it speaks volumes about the way they do politics. It was a clear victory for Miliband, though not necessarily for politics.

It was less about the speeches themselves than the underlying contest for how the riots are understood. For Cameron, they need to be seen as a question of personal responsibility and personal morality. That way he can repackage the broken society. Moral rearmament pleases his long-standing critics on the right and feeds into his broader programme of welfare and educational reform. It also gives him an opportunity to sharpen the message: that, for example, the welfare state denies moral hazard. This was a hard line to argue when the last people to benefit from an absence of moral hazard were the bankers. But in Conservative discourse, it's a trope as old as the welfare state itself, just one that the party so damagingly associated with the destitution of the 1930s tends to discuss in private. He also revisited other favourites: the "twisted and misrepresented" Human Rights Act, the health and safety culture – and he seems to have discovered 120,000 dysfunctional families at the root of society's problems. In short, the nasty party is making a comeback.

Of course, the prime minister has to appear to know what he's doing. Miliband doesn't have that burden. He can afford to sound cautious and to appeal for time, to argue that the underlying causes of riots are much more complex and less open to easy answers. He can afford to call for a commission of inquiry, and he is right to. He is also right to insist that it listens to people on the ground. If the government won't do it, the Labour party should.

For the second time in as many months, Miliband is having a good crisis. He got it right on phone hacking, and he is sounding the right mix of tough and compassionate on the riots. Speaking in the PR-perfect setting of his old school, which stands on the edge of one of the riot-affected areas, he addressed an audience of people who lived and worked across inner-city London. Where Cameron, in a West Oxfordshire youth centre, had to be prompted – by my colleague Michael White – to find out what the young people sitting in his audience thought needed doing, Miliband had an audience bursting with hands-on experience. He called for a pen to take notes: he was the image of the national leader as community organiser, and just because Barack Obama is struggling to make it work doesn't mean it's the wrong model.

But this riot aftermath isn't only a revealing and important moment in politics of left and right. In the short term, an even more important argument is developing between Cameron and Boris Johnson. Johnson never signed up to the "broken Britain" agenda (piffle, he called it), and he's confronting his prime minister on policing numbers and cuts. This is the engagement that will shape the immediate future.