The first child sex scandal in the Catholic church took place in AD153, long before there was a "gay culture" or Jewish journalists for bishops to blame it on. By the 1960s, the problem had become so dire that a cleric responsible for the care of "erring" priests wrote to the Vatican suggesting that it acquire a Caribbean island to put them on.

What has made a bad situation worse, as the eminent QC Geoffrey Robertson argues in this coolly devastating inquiry, is canon law – the church's own arcane, highly secretive legal system, which deals with alleged child abusers in a dismayingly mild manner rather than handing them over to the police. Its "penalties" for raping children include such draconian measures as warnings, rebukes, extra prayers, counselling and a few months on retreat. It is even possible to interpret canon law as claiming that a valid defence for paedophile offences is paedophilia. Since child abusers are supposedly incapable of controlling their sexual urges, this can be used in their defence. It is rather like pleading not guilty to stealing from Tesco's on the grounds that one is a shoplifter. One blindingly simple reason for the huge amount of child abuse in the Catholic church (on one estimate, up to 9% of clerics are implicated) is that the perpetrators know they will almost certainly get away with it.

For almost a quarter of a century, Cardinal Joseph Ratzinger, the man who is now Pope, was in supreme command of this parallel system of justice – a system deliberately hidden from the public, police and parliaments and run, so Robertson maintains, in defiance of international law. Those who imagine that the Vatican has recently agreed to cooperate with the police, he points out, have simply fallen for one of its cynical public relations exercises. In the so-called "New Norms" published by Pope Benedict this year, there is still no instruction to report suspected offenders to the civil authorities, and attempting to ordain a woman is deemed to be as serious an offence as sodomising a child. There have, however, been some changes: victims of child abuse are now allowed to report the matter up to the age of 38 rather than 28. If you happen to be 39, that's just tough luck. As Robertson wryly comments, Jesus declares that child molesters deserve to be drowned in the depths of the sea, not hidden in the depths of the Holy See.

How can Ratzinger get away with it? One mightily important reason, examined in detail in this book, is because he is supposedly a head of state. The Vatican describes itself on its website as an "absolute monarchy", which means that the Pope is immune from being sued or prosecuted. It also means that as the only body in the world with "non-member state" status at the UN, the Catholic church has a global platform for pursuing its goals of diminishing women, demonising homosexuals, obstructing the use of condoms to prevent Aids and refusing to allow abortion even to save the life of the mother. For these purposes, it is sometimes to be found in unholy alliance with states such as Libya and Iran. Neither is it slow to use veiled threats of excommunication to bend Catholic politicians throughout the world to its will. If Pope Benedict were to air some of his troglodytic views with full public force, Robertson suggests, the Home Office would have been forced to refuse him entry into Britain.

In fact, he argues, the Vatican's claim to statehood is bogus. It dates from a treaty established between Mussolini and the Holy See, which Robertson believes has no basis in international law. The Vatican has no permanent population, which is a legal requirement of being a state. In fact, since almost all its inhabitants are celibate, it cannot propagate citizens at all other than by unfortunate accident. It is not really a territory, has no jurisdiction over crimes committed in its precincts and depends for all its essential services on the neighbouring nation of Italy. Nor does it field a team in the World Cup, surely the most convincing sign of its phoniness.

"Petty gossip" is how the Pope has described irrefutable evidence of serious crimes. His time as the Vatican official in charge of overseeing priestly discipline was the period when, in Robertson's furiously eloquent words, "tens of thousands of children were bewitched, buggered and bewildered by Catholic priests whilst [Ratzinger's] attention was fixated on 'evil' homosexuals, sinful divorcees, deviate liberation theologians, planners of families and wearers of condoms".

Can he be brought to book for this? As a widespread and systematic practice, clerical sexual abuse could be considered a crime against humanity, such crimes not being confined to times of war; and though Ratzinger may claim immunity as a head of state, he is also a German citizen. The book comes to no firm conclusion here, but the possibility of convicting the supreme pontiff of aiding and abetting the international crime of systemic child abuse seems not out of the question. The Vatican, in any case, is unlikely to escape such a fate by arguing, as it has done already, that the relations between the Pope and his bishops are of such unfathomable theological complexity that no mere human court could ever hope to grasp them.

This is a book that combines moral passion with steely forensic precision, enlivened with the odd flash of dry wit. With admirable judiciousness, it even finds it in its heart to praise the charitable work of the Catholic church, as well as reminding us that paedophiles (whom Robertson has defended in court) can be kindly men. It is one of the most formidable demolition jobs one could imagine on a man who has done more to discredit the cause of religion than Rasputin and Pat Robertson put together.

Terry Eagleton's latest book is On Evil (Yale).