The organisation that raised Vladimir Putin to the rank of lieutenant colonel once made something of a habit of desecrating churches.

The KGB did not waste much time on theological debate or public opinion. Religion was the enemy of an atheist state, fit only to be suppressed, if not eradicated.

In fact, the not-so-secret police were redoubling their efforts at just around the time the young law graduate from Leningrad State was joining the ranks. In 1975, while Putin was being trained, the Soviet government took formal legal control of the "supervision" of the Orthodox church. Priests liable to make trouble would be suborned, blackmailed, dismissed, or consigned to psychiatric hospitals.

In those days, two-year sentences for those who "crudely undermined social order" would have been regarded as the height of leniency. Even a trumped-up charge of hooliganism – an old Soviet favourite – would probably have led to internal exile. But then, it was no crime to outrage the Orthodox church when Putin was launching his career: quite the reverse. How times change.

Clearly, the old USSR's efforts to destroy religion were a failure: most Russians continued to give their allegiance, overtly or secretly, to an ancient faith. In another sense, young Putin's mentors were brilliantly successful. According to dozens of well-attested accounts, the church was corrupted utterly. Those who progressed through its hierarchy were, at minimum, obedient to the state. Some seem to have obeyed with enthusiasm.

Such accusations are nowadays denied routinely, of course, despite the testimony of those in a position to know, and despite documentary evidence retrieved from the KGB archives. Alexy II, patriarch of Moscow until the end of 2008, allegedly rejoiced in the code name "Drozdov". His successor, Kirill I, was supposedly identified in the files as "Mikhailov". One way or another, these were not people liable to embrace a dissident punk ethos, least of all in a Moscow cathedral.

In Russia, none of this is news, though its significance is a matter of debate. Were these men, and others like them, simply doing whatever had to be done to ensure the survival of a church that had suffered grievously under Stalin and, albeit intermittently, under his successors? Or were they renewing a habit of complicity with the regime that had been a defining feature of Russian life for 300 years before the revolution?

By a fascinating coincidence, Putin himself rediscovered God at around the time he discovered political ambition. Which is to say he returned to his mother's faith in the early 1990s, just as a new Russia was emerging from the wreckage of the USSR and new opportunities were presenting themselves to ambitious products of the secret state. As the world knows, he made the most of his chances.

In the 21st century, he and the Orthodox hierarchy have a lot in common, and make no attempt to conceal the fact. Each finds the suggestion of dissent useful and its reality intolerable. Neither cares for the idea of democratic reform and both promote an adversarial nationalism. Both claim to detect conspiracies on all sides. Neither makes a distinction between what is traditional and what is reactionary – yesterday a Moscow court banned gay pride marches "for 100 years" – and each has uses for a distracting controversy.

Welcome, then, to Pussy Riot. Their protest in Moscow's Christ the Saviour Cathedral in February was exactly to the point. Putin and the church are indeed hand in glove, ostentatiously illiberal, dedicated to turning Orthodoxy into a state religion, and explicitly anti-democratic. Kirill's church has made itself a bulwark for Putin's autocratic regime and the autocrat is happy to return every favour. In February, indeed, the patriarch described the president as "a miracle of God". A protest was in order.

Yet what could be better for Putin and the patriarch than the spectacle of decadent caterwauling feminists outraging the faithful? What no doubt seemed like a "provocation" to Pussy Riot was in reality a welcome gift to a president working to rally conservative opinion after the winter's street protests against rigged elections.

If there have been protests across the West against condign punishments for the exercise of free speech, meanwhile, so much the better for the Kremlin. Madonna or Paul McCartney might not grasp the point, but Russia's leaders tend to thrive under foreign criticism, just as they thrive when they defend the supposed purity of Russian culture, or the sanctity of its Orthodox faith. National pride is a potent weapon.

Putin is in any case liable to present the sentences imposed on the women as, first, none of his doing; secondly as merciful indeed. Put aside the ridiculous pretence of judicial independence and he has a degree of justification for his gall.

A swathe of conservative Russian opinion has reacted to the desecration of the cathedral much as mainstream British opinion reacted to last year's riots. How many politicians in this country objected to disproportionate sentences and jail terms for minor looting? How would they react now to a blasphemous impromptu performance in, say, Westminster Abbey?

You have to wonder about the object of the exercise for Pussy Riot. It was hardly calculated to win hearts and minds among Orthodox Russians. If the idea was to arouse controversy internationally, to draw attention to Putin's abuses of power and the complicity of the church, it showed scant understanding of history. The accusation laid ritually against Putin's opponents is that they are agents of the West. Besides, there are plenty of people, in all countries, who dislike seeing rowdy behaviour – not punk at its finest, let's say – in a place of worship.

The women knew they would be arrested. They probably knew that Putin would give them a modern show trial. They seem not to have been too surprised when the state prosecutor demanded three-year sentences. Yet equally they seem not to have realised that they were playing into the hands of a president who takes pride in his ruthlessness.

Pussy Riot and their supporters would probably answer that when a gesture is all that is available, a gesture is what you must make. The alternative, in Putin's Russia, is silence and implicit acceptance. Ironically, that was precisely the dilemma posed during the long Soviet years. It was precisely the reasoning, in fact, of all the priests who found themselves becoming agents of the state.

Putin understands such thinking. Nature's secret policemen grasp the delicate balance of hope and despair when the difference between "doing something" and doing nothing seems trivial. The protests of a few bohemians do not trouble him in the slightest. If they do not speak for the mass of people – and that seems certain – they can pose no threat. Pussy Riot's heroism might be called to mind by a few Russians in years to come, but their "outrage" has probably served only to strengthen the autocrat and his tame church.

The blessed Orthodox hierarchy can meanwhile do business happily, it seems, with former Communists, no matter how oppressive. Oppression was never the real problem for a church that propped up the brutish tsarist state for three long centuries. What the patriarch and the president fail to notice, however, is that the Russian people are no longer serfs. Pussy Riot should put the fact into a song.