The phone hacking scandal has been a real test of David Cameron.
By his own admission, he is close to two of those accused of wrongdoing. He hired one former editor of the News of the World, Andy Coulson, as his Director of Communications and, as he has been honest enough to admit, Mr Coulson became a friend. Another former editor and now Chief Executive of News International, Rebecca Brooks, lives in the Prime Minister's constituency and is a social acquaintance.
Yesterday, the Prime Minister passed the test with flying colours. He didn't try to deny those personal relationships but he came down unambiguously on the side of the public he is elected to serve, announcing a wide-ranging public inquiry led by one of the most senior judges in the country with the power to summon witnesses to give evidence in public under oath. The inquiry will start by looking at how the press should be regulated and relations between politicians and the press. Once the current criminal investigation is complete, it will go on to look at the extent of unlawful or improper conduct at the News of the World and elsewhere, the original police investigation that failed to get to the truth and the issue of corrupt payments to police officers.
He also made it clear that News International should be focused on getting their house in order, not taking over BSkyB; and he announced proposed changes to the Ministerial Code requiring Ministers to publish details of any meetings with media proprietors, editors and executives.
He spent two hours answering questions from MPs.
He was asked about Rebecca Brooks' position and he was very clear that her offer to resign should have been accepted - even if she knew nothing about what was going on at the News of the World when she was editor, she was in charge and she needs to take responsibility.
He was asked about his decision to hire Andy Coulson. He explained that Andy (who, I should make it clear, I worked alongside for several years and know reasonably well) gave him assurances that he wasn't involved in phone hacking; that these assurances were backed up by the police and Select Committee investigations; and that on the basis that we are innocent until proven guilty he therefore decided to hire him. He paid tribute to the work that Andy did. But he also said, clearly and unequivocally, that if it is proven that Andy lied he should be prosecuted.
Most important of all, the Prime Minister acknowledged that he should have taken the stories about the behaviour of elements of our media more seriously when in opposition and pressed the then government to take action, that his relationship with media propietors and executives had been too close. He took responsibility for his actions and set out what he was going to do to sort things out. It was an impressive performance.
Later in the day, Gordon Brown spoke in the debate on BSkyB. He had some important things to say. He set out the evidence he had received of people working for, or on behalf of, News International - some of them with criminal records - blagging his bank account and legal papers. He talked about the distress caused to him and his wife Sarah when The Sun published what should have been private medical information about his son. Everyone will share his outrage about both of these incidents.
But he then went on to try to rewrite history. He had not tried to cosy up to News International. Really? What about inviting Rupert Murdoch to Chequers? What about his wife organising a party at Chequers for, among others, Murdoch's wife, daughter and Rebecca Brooks?
He also said he had tried to set up a judge-led inquiry but the civil service had advised against it. But of course this was only after The Sun had endorsed David Cameron and if he felt so strongly about it why didn't he insist?
He spoke for half an hour, depriving several other MPs of the chance of speaking in the debate. For most of that time, he refused to take any questions, which showed he had something to hide. Once he had finished, he quickly left the chamber. The contrast with the current Prime Minister could not have been clearer - an attempt to disguise his efforts to cosy up to Rupert Murdoch and no real apology.
Contrast his behaviour with that of other Labour MPs - Tom Watson and Chris Bryant, who have doggedly pursued this story, and Ed Miliband, who deserves some praise too. Until a couple of weeks ago, he was courting Murdoch too - he hired an ex-News International journalist as his Director of Strategy and he attended Murdoch's recent party. But he had the courage to speak out at the beginning of last week. And though he has occasionally sought to claim moral high ground he is not entitled to, yesterday he broadly struck the right tone. He must have been embarrased by the behaviour of his predecessor.