Inside Politics: The past week was, by common consent, the worst experienced by the Fianna Fáil-Progressive Democrat coalition since it was returned to power four years ago.
While much of the criticism heaped on the Coalition was misguided and unfair, the overriding impression created by the controversy was that it had lost touch with the people.
That is a very dangerous position for the Government to have arrived at with just one year to go to an election.
In contrast, the Fine Gael leader, Enda Kenny, emerged from the week with his reputation enhanced.
His performance in the Dáil right through the controversy combined a level of eloquence and political ruthlessness that stunned the Government benches.
It helped to dispel any lingering doubts that he has what it takes to be taoiseach.
The decision of the Supreme Court yesterday to concede the State's appeal and return the 41-year-old child rapist to jail will certainly take the heat out of the controversy. The nightmare scenario for the Government of a procession of rapists winning early release has now been avoided, and the Coalition can breathe a little easier.
When a mightily relieved Minister for Justice, Michael McDowell, announced the court decision in the Seanad, the news was greeted with a round of applause. It was a reflection of just how relieved all politicians were at the outcome.
Nonetheless, Taoiseach Bertie Ahern and Mr McDowell, the politician at the centre of the storm, have both taken a battering from which it will take some time to recover.
Their initial response to the unexpected pressure that followed the first Supreme Court decision made the political problem worse rather than better, as they failed to appreciate just how angry the public was at the legal mess created by the court decision.
The apparently complacent response served to associate the Government in the public mind with responsibility for the Supreme Court decision and the subsequent interpretation of it by Ms Justice Mary Laffoy.
While the emergency legislation, rushed through both Houses of the Oireachtas yesterday, and the clarification issued by the Supreme Court lifted the pressure, political damage has been suffered.
The entire episode was a classic example of how events that have their origin outside the political system can take on a life of their own and wreak havoc on an unsuspecting Government.
Some in Fianna Fáil saw parallels with the Brendan Smyth affair of 1994, which led to the fall of the Albert Reynolds government, while others drew comparisons with the controversy that led to the resignation of Supreme Court judge Hugh O'Flaherty and his High Court colleague, Cyril Kelly, back in 1999.
Neither parallel is exact. The current controversy has some resonance with the collapse of the Reynolds government, in that the failure to protect children was the issue that generated public outrage. Then, as now, the taoiseach, his attorney general and his ministers had no responsibility for the failure of the legal system - but a high political price had to be paid.
The big difference, though, was that what ultimately brought the 1994 government down was not the complicated sequence of events that led to the failure to execute a warrant for the arrest of the paedophile, Brendan Smyth, but the fact that there was already a complete breakdown of trust between the coalition partners, Fianna Fáil and Labour. The Smyth case was the straw that broke the coalition's back but it was not the root cause of the problem.
In the equally complex Philip Sheedy case, which led to the resignation of two judges and threatened the Taoiseach's position, the political fall-out was limited because the coalition partnership of Bertie Ahern and Mary Harney was strong enough to withstand it. The widespread media view that permanent damage had been done to the Government proved wrong.
In the current crisis there have clearly been tensions between Mr McDowell and some of his Fianna Fáil colleagues in the effort to come up with a coherent response.
However, the strong bond between the Coalition parties prevented the problem from spinning out of control and a common line of defence was arrived at and adhered to.
An important factor in enabling the Government to reach agreement was the fact that the main Opposition parties, Fine Gael and Labour, were included in the process of formulating the Criminal Law (Sexual Offences) Bill, 2006.
The differences between Mr McDowell and his colleagues were mirrored in a difference of emphasis between Fine Gael and Labour. Ultimately all four parties were able to put their differences aside in order to reach a consensus on the main points at issue.
From the point of view of the citizen, the heartening thing about the whole affair was that it showed real democracy at work. In the teeth of hysterical coverage by some popular radio programmes, the politicians managed to come up with a complex piece of legislation that reflects the broad public mood in a very short time.
In party political terms, while the Government was helped to work its way through the problem by the consultation process, the Coalition undoubtedly took a hit.
The other side of the coin is that the Opposition parties benefited by being seen to act responsibly in the drafting of the legislation while still being free to attack the Government.
Mr Kenny landed a strong punch at the end of his speech. "To conclude, let me say that in the last few days, people have been looking to the Government to protect their children. But in the last number of years, I believe they have been looking for something just as important, and every bit as absent: leadership. Leadership that acts from courage and conscience.
"Leadership that makes the tough, often unpopular decisions. Leadership that is most notable by its absence in this Government."
The Coalition now has 12 months to prove the Fine Gael leader wrong. But after a couple of bad opinion polls and a miserable no-win political controversy, the Coalition has a lot of work to do to restore its political fortunes.