It was February 18, 2014, and already dark when I crossed the Bay Bridge from San Francisco and parked my car in downtown Oakland. The streets were deserted, save for a couple of homeless men slumped in a heap against a closed storefront. Two police cruisers raced through a red light, sirens blaring.

I approached Oakland’s city hall on foot. Even from a distance, I could see that something unusual was going on. A line of parked police cars ran down the block, and news anchors and TV camera crews scampered about, jockeying for position. A large group of people milled near the entrance, a few of them setting up what looked like a giant papier-mâché rat, presumably intended as a symbol for snitching. But the real action was inside. Several hundred people packed Oakland’s ornate high-domed city council chamber. Many of them carried signs. It was an angry crowd, and police officers flanked the sides of the room, ready to push everyone out if things got out of hand.

Police would be able to punch in a location and watch it in real time or wind back the clock.

The commotion was tied to the main agenda item of the night: the city council was scheduled to vote on an ambitious $11 million project to create a citywide police surveillance hub. Its official name was the “Domain Awareness Center”—but everyone called it “the DAC.” Design specs called for linking real-time video feeds from thousands of cameras across the city and funneling them into a unified control hub. Police would be able to punch in a location and watch it in real time or wind back the clock. They could turn on face recognition and vehicle tracking systems, plug in social media feeds, and enhance their view with data coming in from other law enforcement agencies—both local and federal.

Plans for this surveillance center had been roiling city politics for months, and the outrage was now making its presence felt. Residents, religious leaders, labor activists, retired politicians, masked “black bloc” anarchists, and reps from the American Civil Liberties Union—they were all in attendance, rubbing shoulder to shoulder with a group of dedicated local activists who had banded together to stop the DAC. A nervous, bespectacled city official in a tan suit took the podium to reassure the agitated crowd that the Domain Awareness Center was designed to protect them—not spy on them. “This is not a fusion center. We have no agreements with the NSA or the CIA or the FBI to access our databases,” he said.

The hall blew up in pandemonium. The crowd wasn’t buying it. People booed and hissed. “This is all about monitoring protesters,” someone screamed from the balcony. A young man, his face obscured by a mask, stalked to the front of the room and menacingly jammed his smartphone in the city official’s face and snapped photos. “How does that feel? How do you like that—being surveilled all the time!” he yelled. A middle-aged man—bald, wearing glasses and crumpled khakis—took the podium and tore into the city’s political leaders. “You council members somehow believe that the Oakland Police Department, which has an unparalleled history of violating the civil rights of Oaklanders and which cannot even follow its own policies, be it a crowd control policy or a body camera policy, can somehow be trusted to use the DAC?” He left with a bang, yelling: “The only good DAC is a dead DAC!” Wild applause erupted.

Oakland is one of the most diverse cities in the country. It’s also home to a violent, often unaccountable police department, which has been operating under federal oversight for over a decade. The police abuse has been playing out against a backdrop of increasing gentrification fueled by the area’s Internet boom and the spike in real estate prices that goes along with it. In San Francisco, neighborhoods like the Mission District, historically home to a vibrant Latino community, have turned into condos and lofts and upscale gastro pubs. Teachers, artists, older adults, and anyone else not making a six-figure salary are having a tough time making ends meet. Oakland, which for a time was spared this fate, was now feeling the crush as well. But locals were not going down without a fight. And a lot of their anger was focused on Silicon Valley.

The people gathered at city hall that night saw Oakland’s DAC as an extension of the tech-fueled gentrification that was pushing poorer longtime residents out of the city. “We’re not stupid. We know that the purpose is to monitor Muslims, black and brown communities and protesters,” said a young woman in a headscarf. “This center comes at a time when you’re trying to develop Oakland into a playground and bedroom community for San Francisco professionals. These efforts require you to make Oakland quieter, whiter, less scary and wealthier—and that means getting rid of Muslims, black and brown people, and protesters. You know this and so do developers. We heard them at meetings. They are scared. They verbally admit it.” She had a point. A few months earlier, a pair of Oakland investigative journalists had obtained a cache of internal city-planning documents dealing with the DAC and found that city officials seemed to be interested more in using the proposed surveillance center to monitor political protests and labor union activity at the Oakland docks than in fighting crime.

There was another wrinkle. Oakland had initially contracted out development of the DAC to the Science Applications International Corporation, a massive California-based military contractor that does so much work for the National Security Agency that it is known in the intelligence business as “NSA West.” The company is also a major CIA contractor, involved in everything from monitoring agency employees as part of the agency’s “insider threat” programs to running the CIA’s drone assassination fleet. Multiple Oakland residents came up to blast the city’s decision to partner with a company that was such an integral part of the U.S. military and intelligence apparatus. “SAIC facilitates the telecommunications for the drone program in Afghanistan that’s murdered over a thousand innocent civilians, including children,” said a man in a black sweater. “And this is the company you chose?”

I looked around the room in amazement. This was the heart of a supposedly progressive San Francisco Bay Area, and yet the city planned on partnering with a powerful intelligence contractor to build a police surveillance center that, if press reports were correct, officials wanted to use to spy on and monitor locals. Something made that scene even stranger to me that night. Thanks to a tip from a local activist, I had gotten wind that Oakland had been in talks with Google about demo-ing products in what appeared to be an attempt by the company to get a part of the DAC contract.

Google possibly helping Oakland spy on its residents? If true, it would be particularly damning. Many Oaklanders saw Silicon Valley companies such as Google as being the prime drivers of the skyrocketing housing prices, gentrification, and aggressive policing that was making life miserable for poor and low-income residents. Indeed, just a few weeks earlier protesters had picketed outside the local home of a wealthy Google manager who was personally involved in a nearby luxury real estate development.

Google’s name never came up during the tumultuous city council meeting that night, but I did manage to get my hands on a brief email exchange between a Google “strategic partnership manager” and an Oakland official spearheading the DAC project that hinted at something in the works.

In the weeks after the city council meeting, I attempted to clarify this relationship. What kinds of services did Google offer Oakland’s police surveillance center? How far did the talks progress? Were they fruitful? My requests to Oakland were ignored and Google wasn’t talking either—trying to get answers from the company was like talking to a giant rock. My investigation stalled further when Oakland residents temporarily succeeded in getting the city to halt its plans for the DAC.

What could Google, a company obsessed with its progressive “Don’t Be Evil” image, offer a controversial police surveillance center?

Though Oakland’s police surveillance center was put on hold, the question remained: What could Google, a company obsessed with its progressive “Don’t Be Evil” image, offer a controversial police surveillance center?

At the time, I was a reporter for Pando, a small but fearless San Francisco magazine that covered the politics and business of Silicon Valley. I knew that Google made most of its money through a sophisticated targeted advertising system that tracked its users and built predictive models of their behavior and interests. The company had a glimpse into the lives of close to two billion people who used its platforms—from email to video to mobile phones—and it performed a strange kind of alchemy, turning people’s data into gold: nearly $100 billion in annual revenue and a market capitalization of $600 billion; its cofounders Larry Page and Sergey Brin had a combined personal wealth estimated to be $90 billion.

Google is one of the wealthiest and most powerful corporations in the world, yet it presents itself as one of the good guys: a company on a mission to make the world a better place and a bulwark against corrupt and intrusive governments all around the globe. And yet, as I traced the story and dug into the details of Google’s government contracting business, I discovered that the company was already a full-fledged military contractor, selling versions of its consumer data mining and analysis technology to police departments, city governments, and just about every major U.S. intelligence and military agency. Over the years, it had supplied mapping technology used by the U.S. Army in Iraq, hosted data for the Central Intelligence Agency, indexed the National Security Agency’s vast intelligence databases, built military robots, colaunched a spy satellite with the Pentagon, and leased its cloud computing platform to help police departments predict crime. And Google is not alone. From Amazon to eBay to Facebook—most of the Internet companies we use every day have also grown into powerful corporations that track and profile their users while pursuing partnerships and business relationships with major U.S. military and intelligence agencies. Some parts of these companies are so thoroughly intertwined with America’s security services that it is hard to tell where they end and the U.S. government begins.

Since the start of the personal computer and Internet revolution in the 1990s, we’ve been told again and again that we are in the grips of a liberating technology, a tool that decentralizes power, topples entrenched bureaucracies, and brings more democracy and equality to the world. Personal computers and information networks were supposed to be the new frontier of freedom—a techno-utopia where authoritarian and repressive structures lost their power, and where the creation of a better world was still possible. And all that we, global netizens, had to do for this new and better world to flower and bloom was to get out of the way and let Internet companies innovate and the market work its magic. This narrative has been planted deep into our culture’s collective subconscious and holds a powerful sway over the way we view the Internet today.

But spend time looking at the nitty-gritty business details of the Internet and the story gets darker, less optimistic. If the Internet is truly such a revolutionary break from the past, why are companies like Google in bed with cops and spies?

I tried to answer this seemingly simple question after visiting Oakland that night in February. Little did I know then that this would take me on a deep dive into the history of the Internet and ultimately lead me to write a book. Now, after three years of investigative work, interviews, travel across two continents, and countless hours of correlating and researching historical and declassified records, I know the answer.

Pick up any popular history of the Internet and you will generally find a combination of two narratives describing where this computer networking technology came from. The first narrative is that it emerged out of the military’s need for a communication network that could survive a nuclear blast. That led to the development of the early Internet, first known as ARPANET, built by the Pentagon’s Advanced Research Projects Agency (known today as the Defense Advanced Research Projects Agency, or DARPA). The network went live in the late 1960s and featured a decentralized design that could route messages even if parts of the network were destroyed by a nuclear blast. The second narrative, which is the most dominant, contends that there was no military application of the early Internet at all. In this version, the ARPANET was built by radical young computer engineers and playful hackers deeply influenced by the acid-drenched counterculture of the San Francisco Bay Area. They cared not a damn about war or surveillance or anything of the sort, but dreamed of computer-mediated utopias that would make militaries obsolete. They built a civilian network to bring this future into reality, and it is this version of the ARPANET that then grew into the Internet we use today. For years, a conflict has raged between these historical interpretations. These days, most histories offer a mix of the two—acknowledging the first, yet leaning much more heavily on the second.

My research reveals a third historical strand in the creation of the early Internet—a strand that has all but disappeared from the history books. Here, the impetus was rooted not so much in the need to survive a nuclear attack but in the dark military arts of counterinsurgency and America’s fight against the perceived global spread of communism. In the 1960s, America was a global power overseeing an increasingly volatile world: conflicts and regional insurgencies against U.S.-allied governments from South America to Southeast Asia and the Middle East. These were not traditional wars that involved big armies but guerrilla campaigns and local rebellions, frequently fought in regions where Americans had little previous experience. Who were these people? Why were they rebelling? What could be done to stop them? In military circles, it was believed that these questions were of vital importance to America’s pacification efforts, and some argued that the only effective way to answer them was to develop and leverage computer-aided information technology.

The Internet was hardwired to be a surveillance tool from the start.

The Internet came out of this effort: an attempt to build computer systems that could collect and share intelligence, watch the world in real time, and study and analyze people and political movements with the ultimate goal of predicting and preventing social upheaval. Some even dreamed of creating a sort of early warning radar for human societies: a networked computer system that watched for social and political threats and intercepted them in much the same way that traditional radar did for hostile aircraft. In other words, the Internet was hardwired to be a surveillance tool from the start. No matter what we use the network for today—dating, directions, encrypted chat, email, or just reading the news—it always had a dual-use nature rooted in intelligence gathering and war.

As I traced this forgotten history, I found that I was not so much discovering something new but uncovering something that was plainly obvious to a lot of people not so long ago. Starting in the early 1960s in the United States, a big fear about the proliferation of computer database and networking technologies arose. People worried that these systems would be used by both corporations and governments for surveillance and control. Indeed, the dominant cultural view at the time was that computers and computing technology— including the ARPANET, the military research network that would grow into the Internet we use today—were tools of repression, not liberation.

In the course of my investigation, I was genuinely shocked to discover that as early as 1969, the first year that the ARPANET came online, a group of students at MIT and Harvard attempted to shut down research taking place at their universities under the ARPANET umbrella. They saw this computer network as the start of a hybrid private-public system of surveillance and control—“computerized people-manipulation” they called it—and warned that it would be used to spy on Americans and wage war on progressive political movements. They understood this technology better than we do today. More importantly, they were right. In 1972, almost as soon as the ARPANET was rolled out on a national level, the network was used to help the CIA, the NSA, and the U.S. Army spy on tens of thousands of antiwar and civil rights activists. It was a big scandal at the time, and the ARPANET’s role in it was discussed at length on American television, including NBC Evening News.

This episode, which took place forty-five years ago, is a vital part of the historical record, important to anyone who wants to understand the network that mediates so much of our lives today. Yet you won’t find it mentioned in any recent book or documentary on the origins of the Internet—at least not any that I could find, and I read and watched just about all of them.

In the 1970s, the historical significance of the ARPANET was not yet apparent. It would take more than twenty years for the Internet to spread into most American homes, and four decades would pass before Edward Snowden’s leaks made the world aware of the massive amount of government surveillance happening over the Internet. Today, people still think that surveillance is something foreign to the Internet—something imposed on it from the outside by paranoid government agencies. But history tells a different story. It shows how military and intelligence agencies used the network technology to spy on Americans in the first version of the Internet. Surveillance was baked in from the very beginning.

Excerpted from Surveillance Valley: The Secret Military History of the Internet by Yasha Levine. Copyright © 2018. Available from PublicAffairs, an imprint of Hachette Book Group, Inc.