“Unhappy is the land that needs a hero”, Galileo tells his disillusioned former student Andrea in Bertold Brecht’s Life of Galileo, after he has recanted on his heliocentric theory of the cosmos. Andrea thought that Galileo would martyr himself, but faced with the rack and thumbscrews the astronomer didn’t hesitate to sign a recantation. “I was afraid of physical pain”, he admits.

Galileo’s reputation hasn’t suffered for that weakness. Heedless of Brecht’s admonition, science makes Galileo a hero and martyr persecuted by the cruel and ignorant Church. What’s more, it’s often implied that his fate might have been shared by anyone who, from the Middle Ages to the early Enlightenment, dared to advocate Copernicus’s theory that the Sun, not the Earth, lay at the centre of the heavens. It’s still widely believed that the Italian friar Giordano Bruno was burnt at the stake for holding that view, 33 years before Galileo recanted.

Historians of science oscillate between exasperation and resignation at the fact that nothing they say seems able to dislodge these convictions. They can point out that Copernicus’ book, published in 1543, elicited little more than mild disapproval from the Church for almost a century before Galileo’s trial. They can explain that Bruno’s cosmological ideas constituted a rather minor part of the heretical charges made against him. They can show that it was Galileo’s provocative style and personality – his readiness to lampoon the Pope, say – that landed him in trouble, and that he was wrong anyway in some of his astronomical theories and disputes with clerics (on tides and comets, for example). They can reveal that the conventional narrative of science versus the Church was largely the polemical invention of John William Draper and Andrew Dickson White in the late nineteenth century. It makes no difference. In the “battle for reason”, science must have its heroic martyrs.

Is this perhaps because they are so hard to find? For over the course of history science’s resistance to ideological intervention and manipulation has been largely rather feeble. One of my most disillusioning realisations while researching my book Serving the Reich was of how little scientists in Germany did to oppose the Nazis.

They were of course in an extreme and hazardous situation, yet several German artists, writers (even journalists!), industrialists and, yes, religious leaders voiced criticisms that were nowhere to be found among scientists. The Austrian scientific editor Paul Rosbaud, who himself showed extraordinary bravery working as a spy for the Allies, noted how scientists at Göttingen University vowed to “rise like one man to protest” if the Nazis dared to dismiss their “non-Aryan” colleagues – and yet when it happened, they all seemed to forget this intention, and some even condemned those who resisted their dismissal.

If few scientists in Germany found the fortitude to show active resistance to the Nazis, that partly reflects how rare physical courage is – and who are we to judge them for that? But this isn’t really the issue. Those German scientists who had no sympathy for the National Socialists didn’t just stay silent to save their own skins and careers; they considered it their duty to do so. You could grumble in private, but as a professional academic one was expected to remain “apolitical”, a loyal and patriotic servant of the state. When Einstein denounced the Nazi laws publicly, he was vilified as a traitor to his country, an “atrocity-mongerer” who deserved to be expelled from scientific institutions.

This attitude explains much of the post-war silence of the German scientists. It’s not just that they lacked the honesty and self-awareness to confess, as the Dutch physicist Hendrik Casimir did, that they were held back by fear; most of them didn’t even feel there was a case to be answered. Their aim, they insisted, had been simply to “stay true to science”: an aspiration that became a shield against any recognition of broader civic responsibilities.

This is where danger still lies. Individual scientists are, in my experience, at least as principled, politically engaged and passionate as any other members of society. The passivity that historian Joseph Haberer deplored in 1969 – in which scientists merely offer their technical advice to the prevailing political system – seems instead to stem from science as an institution.

It isn’t just that science has in general lacked structures for mounting effective resistance to political and ideological interference. Until recently, many scientists still saw it as a virtue to avoid “political” positions. The Observer’s “Rational Heroes” column asks scientists why so few of them go into politics; physicist Steven Weinberg’s triumphant answer was that in science “you can sometimes be sure that what you say is true”. The implication is that science occupies a higher plane, unsullied by the compromised dissembling of politics.

This was Werner Heisenberg’s view too, and it enabled him to turn a blind eye to the depravities of the Nazis and to advance his career in Germany without exactly supporting them. “We should conscientiously fulfil the duties and tasks that life presents to us without asking much about the why or the wherefore”, he wrote.

At the top of many scientists’ political agenda are not political questions as such but demands for more funding. They should beware the example of the German physicists like Heisenberg who triumphantly proclaimed their cleverness at getting money out of the Nazis, whereas in fact Himmler and Goering were perfectly happy to fund tame academics. “Whether they support the regime or not”, a group of leading historians of science has written recently, “most scientists, or perhaps better put [indeed!], scientific communities, will do what they have to in order to be able to do science.”

When inspiring opponents of political repression, such as Andrei Sakharov and Fang Lizhi, have arisen from the ranks of scientists, it has been their personal courage, not their beliefs in the role of science in society, that has sustained them, and they were afforded no official backing from the scientific bodies of their countries.

Because science works best when it is approached without prejudices (as far as that is humanly possible), it is tempting to equate this operational prerequisite with freedom of thought more generally. Yet not only does science have no monopoly on that, but it risks deluding itself if it elevates prickly, brilliant iconoclasts to the status of champions of free speech. History gives no support to that equation.

Philip Ball is author of Serving the Reich: The Struggle for the Soul of Physics Under Hitler, published in paperback by Vintage (2014). The Guardian review can be read here.