It’s not always true that if you’re under attack from both sides of the political spectrum, you’re probably doing the right thing. The smart or moral course is sometimes resolutely partisan. But watching President Obama take flak from the left and the right for his speech on intelligence reform, I believe he’s striking a difficult balance on a crucial topic.

In his speech, Obama defended the essential structure of U.S. surveillance activities. He argued that the National Security Agency is not a rogue outfit, that it plays by the rules and is staffed by patriotic men and women. But in an important admission, he also made clear that after 9/11, the NSA and American intelligence efforts in general went too far. Taking advantage of its unique technological capabilities, the U.S. government did whatever it could, rarely asking whether it should. The President proposed some new checks on decisions to collect data and new constraints on how it is stored and when it can be accessed.

The speech annoyed liberals and conservatives suspicious of government overreach, but reaction from the left has been more anguished. Many voices have begun arguing that Edward Snowden’s revelations show that U.S. intelligence operations have run amok and are illegal and unconstitutional and that Snowden deserves to be pardoned and treated like a hero. The factual basis for every one of these claims is weak. A large number of Snowden’s revelations involve not domestic surveillance but foreign intelligence operations, a standard role for U.S. spy agencies. They show, for example, that the U.S. government is spying on the Taliban and Pakistan. They show that the NSA is spying on foreign leaders like Germany’s Angela Merkel and top aides to Brazil’s Dilma Rousseff. Now, you might regard some of these choices as wise and others as mistaken, but there is nothing unprecedented about countries spying on foreign leaders. Obama conceded too much when he promised not to eavesdrop on a host of them. Foreign governments will certainly not return the favor and stop what is often a relentless effort to spy on America’s top officials and CEOs.

There is a gaping hole in the left’s understanding of U.S. intelligence work. The U.S.–its government, businesses and people–is under massive, sustained surveillance from and infiltration by criminals, terrorists and foreign governments. The Chairman of the Joint Chiefs of Staff pointed out recently that since 2011, cyberattacks on America’s critical infrastructure–chemical, electrical, water and transport systems–have risen seventeenfold. The National Nuclear Security Administration, which is responsible for the country’s nuclear power plants, reported in 2012 that it faces 10 million cyberattacks every day–that’s 3.65 billion in one year. Every major bank and corporation, from Bank of America to Goldman Sachs to the New York Times, faces almost continuous efforts from abroad to penetrate its networks, mine its data, disrupt its procedures and steal its secrets. The effects can range from disruption of transactions to systemic damage that feels more like a military invasion.

It would be impossible to defend against these attacks without allowing intelligence agencies to spy on foreign governments and groups abroad. But it is also crucial that the NSA and others have some ability to enter into telecommunications systems at home to track cyberattacks, figure out where they come from and render them ineffective. Former Justice Department official Jack Goldsmith notes that the New York Times objects to foreign cyberattacks yet wants the NSA to shut down its surveillance at home. In fact, he writes in the New Republic, “To keep our computer and telecommunication networks secure, the government will eventually need to monitor and collect intelligence on those networks using techniques similar to ones the Times and many others find reprehensible when done for counterterrorism ends.”

We all live, bank, work and play in a new parallel world of computer identities, data and transactions. But we do not seem to realize that this enormous freedom of activity in the cyberworld, as in the real world, has to be defended. Just as the police need basic information about your life and activities, the government will need information about the cyberworld. As General Keith Alexander, the NSA’s director, has pointed out, there is no way to defend these systems without getting into them in the first place.

In “Federalist No. 51,” father of the American Constitution James Madison wrote (along with Alexander Hamilton) that in setting up a government, “the great difficulty lies in this: you must first enable the government to control the governed; and in the next place oblige it to control itself.” That is the balance we have to strike, in cyberspace as anywhere else.