Days after President John F. Kennedy was assassinated, a Pentagon agency was given a top-secret assignment to come up with technology to protect the president. What they looked at—from gassing bystanders to arming Secret Service agents with nonlethal squirt guns—was a lesson in the futility of perfect security.

Imagine angry protesters surrounding President Donald Trump’s motorcade as it heads down Fifth Avenue in New York. Now, imagine Secret Service agents spraying a gas that instantly pacifies those protesters; the hostility melts away and the crowd is suddenly docile.

In late 1963, just weeks after President John F. Kennedy was assassinated, scientists taking part in a top-secret Pentagon project came up with just such an outlandish proposal, as well as many others, including a squirt gun that could incapacitate bystanders.

The proposal to gas crowds, however, was perhaps the most bizarre.

“There also exists a need for a system which would make an unfriendly crowd become friendly almost instantaneously,” read the classified report by a Pentagon contractor. “This goes beyond the desire to divert a crowd, as could be done by the prompt and generous use of cash money. The possible use of gasses, sound, lights and other chemical biological or psychological agents to achieve such a change as well as other attributes they might possess for crowd control will require further study.”

The military division that sponsored this research was the Defense Advanced Research Projects Agency, or DARPA, which was founded in 1958 to help get America into space. Though better known today as the agency that laid the groundwork for the internet, stealth aircraft, and drones, DARPA also played a key role in a number of highly classified projects in the 1960s, including a secret plan to develop technology to protect the president of the United States from assassination.

Until today, the only public references to this project was a single brief footnote in an obscure 1975 report, and a brief mention by former Rand Corporation analyst Anthony Russo, who helped Daniel Ellsberg leak the Pentagon Papers. Russo called the presidential protection work “particularly special,” noting that “its classification is higher than top secret.” He revealed nothing else about it, however.

But on Nov. 21, 2013, just one day short of the 50th anniversary of Kennedy’s death, in response to my Freedom of Information Act Request, the National Archives and Records Administration in College Park, Maryland, declassified and released a majority of the files related to this project. A subsequent FOIA lawsuit I won against the Defense Department, as well as interviews I conducted for a new book covering the history of DARPA, provided more details.

What those records and interviews reveal is a project that explored ideas ranging from the ambitious to the outrageous. While certainly not all of the proposals came to fruition, DARPA’s project was a bellwether for the massive rise of presidential protection, from high-tech armored automobiles to aircraft with elaborate countermeasures. It was also an early lesson in understanding how over-the-top the business of protecting the president could get.

***

The Friday night Kennedy was assassinated, Robert Sproull, the newly appointed director of DARPA, had dinner with his two deputies, Robert Frosch and Charles Herzfeld. It was a somber evening, Frosch recalled, and consisted of the three normally loquacious scientists eating in silence, with each occasionally interjecting the repeated statement, “The president’s been shot.”

The assassination laid bare the shortcomings in presidential protection. The midnight-blue presidential limousine that carried Kennedy to his death had blue mouton rugs and lap robes with hand-embroidered presidential seals. On bad weather days, a protective bubbletop made of plastic panels allowed the public a clear view of the president. The car was even outfitted with a hydraulic rear seat that could elevate the president.

The bubbletop wasn’t necessary in Dallas on Nov. 22, 1963, when temperatures reached the low 70s. The limousine traveled in the motorcade with its top down, though it wouldn’t have made much difference either way. The four-door Lincoln Continental convertible fit the image of Camelot, but the vehicle offered no protection against the bullets that ripped through Kennedy, killing him instantly.

Secret Service agents at the time of the assassination were little more than armed bodyguards. The commander in chief needed better protection, starting with the presidential limousine, but Secret Service agents had no experience developing, or even buying, armored vehicles. The Defense Department did, however, and so within days of the assassination, the White House turned to the Pentagon for help, and the Pentagon turned to the scientists at DARPA.

“Word comes down from Harold Brown’s office, it was the director of defense research and engineering, at the time, that somebody in the White House, though it was never clear whether it was the president or someone else, thinks something should be done about a better armored limousine,” Frosch, DARPA’s deputy director at the time, recalled.

Even at five years old, DARPA was already regarded in the Pentagon as an agency that could quickly solve complex problems. Need an agency to develop a worldwide network of seismic sensors to detect secret Soviet nuclear tests? DARPA could do it. The agency also had a fast-growing classified program in counterinsurgency focused on Southeast Asia. The work, focused on the growing conflict in Vietnam, gave the agency experience researching potential anti-assassination technologies ranging from vehicle armor to sniper detection.

So, on the Monday after Kennedy was killed, DARPA was told to start looking for ways to protect the president. The first order of business was keeping the project secret. The newly sworn-in Lyndon Johnson was going to be running for reelection soon, and he wasn’t interested in anything that would make it look like he was cowering behind bulletproof glass. If Johnson found out about an entire project dedicated to protecting the president, he’d be furious.

“We couldn’t possibly let the project be known,” recalled Sproull. “As soon as it became known, it would be killed, and that was complicated because ordinary security isn’t enough. You know the Pentagon leaks like a sieve. So, how are we going to keep it quiet?”

DARPA officials were known for breaking rules, or at least bending them. When Sproull, a university physicist, accepted the job as director, he used his personal sailboat to travel to Washington, D.C., charging the government mileage as if he were driving his car. Under his leadership, DARPA did everything from equipping Vietnamese soldiers with technologies to fight in the jungles to pursuing a computer network that would lay the foundations of the modern internet.

But conducting a presidential protection program hidden from the president himself took DARPA to an entirely new level. The project needed to be conducted in strict secrecy, so it was attached to DARPA’s counterinsurgency office, which was already highly classified. Putting it there was a way of keeping the research below the radar, while also taking advantage of the agency’s experience in unconventional warfare.

Even so, within a few weeks of starting, Kermit Gordon, the powerful director of the U.S. Bureau of the Budget, got word of the nascent project and demanded a meeting with the Pentagon’s Harold Brown, who brought along the DARPA director.

Gordon, a normally staid bureaucrat, was in shock. He just kept repeating that if President Johnson found out about DARPA’s work, they would all lose their jobs, even Defense Secretary Robert McNamara. As the low man on that totem pole, the DARPA director was the most expendable. “I was no problem, but Kermit Gordon was thinking of his own head, sure,” Sproull recalled.

Brown, who like Sproull was a physicist, calmly explained his position to Gordon, laying out what DARPA was doing to keep the project quiet and small. “Well, Kermit, what do we do?” Brown finally asked.

Gordon sighed and replied: “Well, I think there’re only two things possible. One is we shut up the shop this afternoon, not tomorrow, but this afternoon. Or, the other is, we go over [Johnson’s] head. I suggest we go over his head.”

The government’s White House budget director had just proposed they go over the newly sworn in president’s head. And that’s exactly what happened: DARPA embarked on a project to protect the president, without the president’s approval, or even knowledge.

A formal memo from Brown’s office on Dec. 3, 1963 laid out DARPA’s broad assignment. DARPA was to help immediately armor the presidential limousine, and then brainstorm ideas for other technologies and strategies to protect the commander in chief. By the end of December, the work was given the formal name, Project Star, short for Strategic Threat Analysis and Research. Privately, however, Brown, took to calling it “Operation Barn Door,” because, as Harold Frosch put it, “that’s what you [close] after the horses have already escaped.”

***

Project Star was launched with a few hastily arranged meetings between White House and DARPA officials. The immediate priority was “Operation Quick Fix,” which involved the armoring of the presidential automobile. Amazingly, even though the original automobile was regarded as a crime scene, and briefly impounded by Chief Justice Earl Warren as part of his commission to investigate the assassination, the Secret Service was intent on returning that same vehicle to service.

The main difficulty was adding sufficient armor to protect against bullets, but not so much weight that the entire chassis would have to be redesigned. In the end, the car’s lower doors were armored with titanium alloy plates, and steel was placed on the floor. It turned out to be more difficult to redesign the bubble top with curved glass. It took several attempts to manufacture the bulletproof glass, without it cracking.

DARPA was also assigned primary responsibility for designing the follow-on automobiles, and to find ways to help ensure the president’s security while traveling, whether in his official car, on a helicopter, or while giving a speech. DARPA would, in essence, be the go-to agency for technical ideas on security.

Just a month into the project, however, DARPA was butting heads with the Treasury Department, which at the time was in charge of the Secret Service. DARPA officials were frustrated with their counterparts’ lack of technical expertise, which often led agents to propose weapons that sounded like they were inspired by a Roadrunner cartoon. For example, the Treasury Department’s Law Enforcement Coordinator, Arnold Sagalyn, began to hound DARPA for a nonlethal weapon that would immediately disable a potential assassin. Sagalyn, a former assistant to famed American prohibition agent Elliot Ness, knew a lot about murder, prostitution, and organized crime, but not much about weapons technology.

Sagalyn seemed to think new technology could be developed in weeks, much to the frustration of DARPA officials, who knew that designing such weapons might take years. DARPA looked at the options, and found that sound weapons couldn’t reliably disable people, tear gas couldn’t be directed at a single individual, and most of the other options either had too short a range or were unreliable. In one handwritten memo, DARPA’s Col. Harry Tabor, who was in charge of Star, sarcastically griped that Sagalyn was “disappointed that we had not yet—in the several weeks we have been in contact with him—produced and tested an effective non-lethal weapon for control of individuals and crowds.”

DARPA officials did test some of the weapons the Treasury Department had in mind, like a ninja-inspired billy club with a stabbing end that projected out at high speed. It turned out to be comically bad, particularly if you consider a Secret Service agent trying to use it against a would-be assassin. Either the club collapsed after several uses, or the users lost their grip. Other proposed weapons, like an aerosol gun that dispensed tear gas, risked disabling the agent using the weapon if he or she hadn’t donned a gas mask ahead of time.

At one point, DARPA, at the Secret Service’s request, paid for the development of a high-powered squirt gun that was designed to disable a single person in a crowd. The gun would fire a high-power stream of liquid containing capsicum, the active ingredient in tear gas. Getting the liquid to go out in a relatively concentrated stream beyond 20 feet was difficult (and if someone was indeed an imminent threat to the president, the more likely weapon of choice for any Secret Service agent would be a regular gun).

The frustration went both ways, however. The Treasury Department mocked DARPA’s James Bond-inspired suggestions, like a proposal to electrify the chrome strips of the presidential limousine to prevent crowds from overturning the vehicle. An armored vehicle would be too heavy to overturn anyhow, the Treasury Department pointed out.

For technical expertise, DARPA turned to some of its trusted contractors, including Rand Corp., best known for ruminating on nuclear Armageddon. The contractors came up with some proposals—such as gassing unfriendly crowds—that never made it off the drawing board. Other concepts of more technical promise—such as creating a metal screen of rotating rods that would deflect bullets while still allowing visibility of the president—were deemed impractical. Project Star also included brainstorming sessions that produced ideas that ranged from the obvious, like having the president wear body armor, to the far-fetched, like a “mirage producing system” that involved heating the air or gas around the president to change the index of refraction (in other words distorting light, which would make it harder for an assassin to take aim). Some suggested tactics failed the proverbial snicker test, such as having the president continuously “move about when in the car,” or use armor disguised as a sunshade, which might require “spreading false weather reports” to justify its use.

One proposal examined under Star was to have a continuous stream of air flowing in front of the president’s speaker stand. It was thought this airflow might slightly deflect bullets or other projectiles, at least enough to protect the president from a direct hit. Simple calculations showed that the air stream would have a minimal effect on anything except tomatoes, and even then, the scientists predicted the tomato thrower would be able to correct his or her aim by the second or third throw.

On the other hand, a variation of that idea, to have a continuous air stream directed at flags positioned behind the president, was adopted, recalled Harold Brown. “The rationale was that a waving flag background could confuse a shooter’s aim,” he wrote me, when I emailed him recently about Project Star. “How that has worked out in theory or practice I have no idea.”

***

By the fall of 1964, DARPA officials were frustrated with constant pestering from the Treasury Department. The Secret Service wanted nifty gadgets and futuristic weapons, and DARPA’s scientists wanted to take an analytical approach to presidential protection. No one seemed to agree on the overall goal of the project. Was it technology development? Was it threat analysis? “Call off Star,” read one plaintive handwritten note, in DARPA’s project files.

Project Star burned out on its own the following year. At that point, DARPA’s contributions included its work on the Quick Fix presidential limousine, the design of the two second-generation automobiles, upgrades to the presidential helicopter, some two-dozen classified studies covering various aspects of presidential security, and the squirt gun. Though the squirt guns were delivered in 1965, the Project Star files note they were misplaced, and apparently never used.

Perhaps the most important lesson of Star, as one Rand analyst working for DARPA noted, is that perfect security is not always the desirable goal. “If you let the Ppresident roam free with no protection or restrictions, his chance of survival for any extended length of time would be nil,” the analyst wrote. “On the other hand, to minimize the risk of assassination, the President should be kept in a lead-lined box buried several thousand feet underground; but he would then have zero ability to perform his job.”

Today, the president travels with massive advance teams, motorcades with sophisticated countermeasures, not to mention heavily armed Secret Service agents. The irony of Project Star is that almost nothing DARPA or its contractors proposed (short of spraying civilians with a “happy” gas) was as ambitious as the presidential security complex that emerged over the past half century. Even with their imaginations set free, the nation’s military scientists never dreamed of a security bubble as elaborate as the one that protects the president today.

As for DARPA, its modest contributions to presidential security were largely forgotten, buried in secrecy. On the other hand, its counterinsurgency office, to which the project was attached, expanded rapidly over the next decade. Among other technological novelties, DARPA sponsored an armed drone designed to identify and kill individual Vietc Cong fighters. DARPA may not have done much to prevent presidential assassination, but ironically, the progeny of its drone work, the Predator, eventually became one of the most effective tools of targeted killing in modern history.

Excerpted from The Imagineers of War: The Untold Story of DARPA, the Pentagon Agency That Changed the World by Sharon Weinberger, published by Knopf. Copyright © 2017.