Some of the world's largest employers of mathematicians have been at the centre of a major international scandal for the last ten months, stand accused of law-breaking on an industrial scale, and are now the object of widespread outrage. How has the mathematical community responded? Largely, by ignoring it.

The US National Security Agency (NSA) and Britain's Government Communications Headquarters (GCHQ) have been systematically monitoring as much of our lives as they possibly can, including our emails, texts, phone calls, Skype calls, bank transactions, web browsing, and physical location. The goal, to quote the NSA's director: "collect all the signals, all the time".

They have tapped internet trunk cables, bugged charities and political leaders, conducted economic espionage, hacked major cloud servers, and disrupted lawful activist groups, all under the banner of national security.

Perhaps most pertinently to mathematicians, the NSA has deliberately undermined internet encryption. Certain encryption methods use pseudo-random number generators based on the theory of elliptic curves. The NSA successfully inserted a secret back door into a standard elliptic curve algorithm, allowing it to break the encryption. (For mathematical details, see Thomas Hales, The NSA back door to NIST, Notices of the American Mathematical Society, February 2014.) Sabotaging internet security makes computers more vulnerable to all attackers, not only the NSA and GCHQ.

The NSA is said to be the largest employer of mathematicians in the world. It partially funds GCHQ, itself a major mathematical employer, and it also works closely with the intelligence agencies of Australia, New Zealand and Canada. Some mathematicians are employed by them full-time; others, with university jobs, work there over summers or sabbaticals.

We may never know exactly what mathematicians have enabled. GCHQ's policy is not to comment on intelligence matters (which is to say, anything it does). Both GCHQ and the NSA have introduced whole-population surveillance with so little democratic process that in both countries, senior politicians on national intelligence committees say they were never informed that such programmes even exist.

Terrorism is the usual justification. American officials repeatedly claimed that mass surveillance had thwarted 54 terrorist attacks. But under questioning, the NSA eventually scaled that figure back to just one or two. (The primary example cited by the NSA was not even a plot; it was a taxi driver accused of giving a terrorist group $8500.) In a court ruling, federal judge Richard Leon noted the "utter lack of evidence that a terrorist attack has been prevented" by the NSA's bulk data collection.

Indifference to mass surveillance rests partly on misconceptions such as "it's only metadata". This is certainly false; for instance, GCHQ has used webcams to harvest images, many sexual, of millions of ordinary citizens. It is also misguided, even according to the NSA's former legal counsel, Stewart Baker: "metadata absolutely tells you everything about somebody's life".

Some people claim to be unbothered by the recording of their daily activities, confident that no one will examine their records. They may be right. If you never trouble the state, perhaps the state will never trouble you. But even so, do you want the secret services to hold such powerful tools for stifling dissent, activism, and even journalism? Do you mind them collecting everyone else's secrets — including, say, those of a presidential candidate committed to downsizing the NSA?

The NSA has been legally found to have lied repeatedly to the secret court that regulates it. That court rejects just 1 in 3000 of the NSA's surveillance requests. Even so, GCHQ claims "a light oversight regime compared with the US". Do you trust such organizations, barely supervised and thoroughly hidden from public scrutiny, never to abuse their vast power?

Mathematicians seldom have to face ethical questions. We enjoy the feeling that what we do is removed from the everyday world, in a safe space without ambiguity or human complications. In 1940, the mathematician G. H. Hardy famously wrote: "I have never done anything 'useful'. No discovery of mine has made, or is likely to make, directly or indirectly, for good or ill, the least difference to the amenity of the world."

That ideal is untenable. Like everyone else, mathematicians need money. We remind governments that our work has practical applications, frequently mentioning that number theory (a branch of apparently "pure" mathematics at which Hardy excelled) is vital to internet encryption.

But it is also vital to the undermining of internet encryption. Our work can be used for both good and ill. Unfortunately for us, it is the ill that is in the public mind; already unpopular after the banking scandals, we now have our largest employer running a system of whole-population surveillance that even a G. W. Bush-appointed judge described as "almost Orwellian".

Mathematicians must decide: cooperate with the secret services or not?

Our situation has been compared to that of nuclear physicists in the 1940s. However, the physicists knew they were building the bomb, whereas mathematicians working for GCHQ or the NSA may have little idea how their work will be used. Those who have helped the agencies in the past, trusting that they were contributing to legitimate national security, may justifiably feel betrayed.

At a bare minimum, we in the mathematical community should talk about it. The eminent mathematician Alexander Beilinson has proposed that working for the NSA and its partners should be made "socially unacceptable". Not everyone will agree, but it reminds us that we have both individual choice and collective power.

Individuals can withdraw their labour. Heads of university departments can refuse staff leave to work for the NSA or GCHQ. National mathematical societies can stop publishing the secret services' recruitment ads, refuse their money, and even — if they choose — expel members who work for agencies of mass surveillance.

At a bare minimum, let us acknowledge that these choices are ours to make. We are human beings before we are mathematicians, and if we do not like what the secret services are doing, we should not cooperate.

Tom Leinster
School of Mathematics, University of Edinburgh