On Monday, the Defense Department's best-known geek announced that she was leaving the Pentagon for a job at Google. It was an unexpected move: Washington and Mountain View don't trade top executives very often. But it shouldn't come as a complete surprise. The internet colossus has had a long and deeply complicated relationship with America's military and intelligence communities. Depending on the topic, the time, and the players involved, the Pentagon and the Plex can be customers, business partners, adversaries, or wary allies. Recruiting the director of Darpa to join Google was just the latest move in this intricate dance between behemoths.

But in the halls of the Pentagon and America's intelligence agencies, Google casts a relatively small shadow, at least compared to those of big defense contractors like Lockheed Martin, Booz Allen Hamilton, and Northrop Grumman, and SAIC. Yes, a small handful of one-time Googlers joined the Obama administration after the 2008 election, but most of those people are now back in the private sector. Sure, Google turned to the network defense specialists at the National Security Agency, when the company became the target of a sophisticated hacking campaign in 2009. The Lockheeds and the Northrops of the world share with the Pentagon information about viruses and malware in their networks every day.

Government work is, after all, only a minuscule part of Google's business. And that allows the Plex to take a nuanced, many-pronged approach when dealing with spooks and generals. (The company did not respond to requests to comment for this article.)

Google has a federally focused sales force, marketing its search appliances and its apps to the government. They've sold millions of dollars' worth of gear to the National Security Agency's secretive eavesdroppers and to the National Geospatial-Intelligence Agency's satellite watchmen. And they're making major inroads in the mobile market, where Android has become the operating system of choice for the military's burgeoning smartphone experiments. But unlike other businesses operating in the Beltway, Google doesn't often customize its wares for its Washington clients. It's a largely take-it-or-leave-it approach to marketing.

"They shit all over any request for customization," says a former Google executive. "The attitude is: ‘we know how to build software. If you don't know how to use it, you're an idiot.'"

Some of that software, though, only made it to Mountain View after an infusion of government cash. Take the mapping firm Keyhole, backed by In-Q-Tel, the investment arm of the Central Intelligence Agency. Google bought Keyhole in 2004 - and then turned it into the backbone for Google Earth, which has become a must-have tool in all sorts of imagery analysis cells. When I visited a team of Air Force targeteers in 2009, a Google Earth map highlighting all the known hospitals, mosques, graveyards, and schools in Afghanistan helped them pick which buildings to bomb or not.

Around the same time, the investment arms of Google and the CIA both put cash into Recorded Future, a company that monitors social media in real time - and tries to use that information to predict upcoming events.

"Turns out that there are several natural places to take an ability to harvest and analyze the internet to predict future events," e-mails Recorded Future CEO Christopher Ahlberg. "There's search, where any innovation that provides improved relevance is helpful; and intelligence, which at some level is all about predicting events and their implications. (Finance is a third.) That made Google Ventures and In-Q-Tel two very natural investors that provides us hooks into the worlds of search and intelligence."
The government and Google have more than a mutual interest in mining publicly available data. The feds ask Google to turn over information about its customers. Constantly. Last fall, the Justice Department demanded that the company give up the IP addresses of Wikileaks supporters. During the first six months of 2011, U.S. government agencies sent Google 5,950 criminal investigation requests for data on Google users and services, as our sister blog Threat Level noted at the time. That's an average of 31 a day, and Google said it complied with 93 percent of those requests.

Google is pretty much the only company that publishes the number of requests it receives - a tactic which sometimes causes teeth to grind in D.C. But it's essential to the well-being of Plex's core business: its consumer search advertising. Google, as we all know, keeps a titanic amount of information about every aspect of our online lives. Customers largely have trusted the company so far, because of the quality of its products, and because there's some sense that the Plex and the Pentagon aren't swapping data wholesale. These small acts of resistance maintain that perceived barrier.

Not long ago - in the middle of the last decade, say - Google held an almost talismanic power inside military and intelligence agencies. Google made searching the web simple and straightforward. Surely, the government ought to be able to do the same for its databases.

"You kept hearing: ‘how come this can't work like Google,'" says Bob Gourley, who served as the Defense Intelligence Agency's Chief Technology Officer from 2005 to 2007. "But after a while the technologists got educated. You don't really want Google."

Or at least, not in that way. Even complex web searches are single strands of information. Intelligence analysts are hunting for interlocking chains of events: Person A in the same cafe as person B, who chats with person C, who gives some cash to person D. Those queries were so intricate, government engineers had to program each one in by hand, not so long ago. But lately, more sophisticated tools have come onto the market; the troops and spooks have gotten better at integrating their databases. Google's products are still used, of course. But it's just one vendor among many.