At 8:07 a.m. on January 13, 2018, every smartphone screen in Hawaii lit up with a single message, in all caps: “BALLISTIC MISSILE THREAT INBOUND TO HAWAII. SEEK IMMEDIATE SHELTER. THIS IS NOT A DRILL.” In fact, it was a false alarm triggered by a Hawaii Emergency Management Agency worker who mistook instructions he had received during an unscheduled emergency drill for a real attack. Nevertheless, motorists drove erratically as they raced to park their car inside a freeway tunnel. Spectators fled sporting events, and college students ran to campus tsunami shelters. Some people called or texted their loved ones to say goodbye.

It was not until 8:38 a.m. that the State of Hawaii issued a correction on its emergency-alert system. It took nearly half an hour, the governor later confessed, because he could not remember the login for his official Twitter account. The White House issued no communication until later in the day, when a deputy press secretary said in a statement that the president had been briefed on the incident and that “this was purely a state exercise.”

From the safety of my apartment in Oakland, California, I had two thoughts: First, I was glad to be headed to the farmers’ market that Saturday morning—and glad not to be serving as secretary of homeland security anymore. Second, it was clear that the incident, however bizarre it appeared on the surface, revealed systemic failures far more serious than any being discussed in the media. What if this had been not an accident, but a hack by a hostile actor intended to cause chaos not only in one American city or state but in many? What if the goal had been to distract Americans and provide cover for another type of attack? What if public panic caused traffic accidents or heart attacks? A breakdown in public order?

In the four years I led the Department of Homeland Security, I learned from the inside that the greatest threats to our safety play out differently from how political speeches and news reports might have us believe. True security means educating the public about which dangers are real and likely and which are not. Hours after a man killed more than four dozen people in two mosques in Christchurch, New Zealand, President Donald Trump downplayed the threat of violence by white-supremacist groups—and went on to contend that the United States is under “invasion” from the south. In fact, mass shootings are genuine security problems. Natural disasters and cyberattacks are genuine security problems. Undocumented immigrants supposedly running over an open border by the millions and attacking Americans on the streets are not.

In a huge and open nation, there will never be enough money, gates, guns, or guards to run down every potential threat. Homeland security works when we adhere to proven principles of law enforcement, national security, and disaster management, and when we integrate those principles with the best data science and other technological innovations available and update them constantly. We get into trouble when political ideology is thrown into the mix. A stubborn or willful misreading of the threat environment leads to poor management of resources and results in failure. And in this regard, I regret to say, we are backsliding terribly.

Border protection is one such area. Vetting travelers primarily by nation of origin, as President Trump’s ban on travelers from certain predominantly Muslim countries does, is not a very effective way of catching terrorists. While offering the illusion of toughness, the ban misdirects our efforts. Rather than directing Customs and Border Protection to fend off every traveler from, say, Syria or Yemen, the agency’s resources are better spent when focused on people who, regardless of which passport they use, have suspicious connections and a pattern of traveling to suspicious places.

Meanwhile, meat-ax policies such as Trump’s ban provide propaganda points to adversaries and antagonize our allies in the Islamic world—governments whose cooperation has, in the past, helped us immensely. They become, as a result, less reliable partners in endeavoring to mitigate threats to the United States on their soil before those threats mature on ours. We become a go-it-alone nation in protecting our own security rather than working with partners. Similarly, the border wall between the United States and Mexico threatens to waste money, attention, and political capital and antagonize Mexico, our neighbor and ally. In 2013, Mexican intelligence helped the United States foil a plot by an Iranian American who tried to recruit a Mexican drug cartel to bomb a Washington, D.C., restaurant where the Saudi ambassador to the United States dined. We would like Mexico to continue helping us in this way.

The choice is not between an open border and a wall. To promote security and the rule of law, we should focus on smart, cost-effective solutions to securing the border. There are far more effective measures involving technology and hybrid approaches combining physical barriers, surveillance, and the presence of agents that can secure the border.

We are also moving backwards on immigration enforcement. Even before the mayhem caused by the separation of families at the southern border, the Trump administration’s often draconian deportation policy deepened a culture of fear in immigrant communities throughout the United States. Already, many undocumented immigrants will refuse to cooperate with local law enforcement when they are witnesses to—or victims of—a crime. Others do not seek health care (increasing emergency-room costs and undermining preventive care, such as vaccines) or dare to present themselves to the DMV to obtain a driver’s license. None of this advances the security of our communities.

The ongoing ambiguity regarding the Deferred Action for Childhood Arrivals (DACA) program—for undocumented immigrants who were brought to the United States as children—represents another waste. It is a waste of human capital and of government resources to hunt down and deport law-abiding DACA participants instead of focusing on criminals and border crime.

Meanwhile, some of the gravest threats facing us lie elsewhere. As the false alarm in Hawaii showed, technological advances bring both the ability to advance security and the possibility of doing great harm in unpredictable ways. Lost and troubled young people will keep searching for combat weapons they can buy over the counter or for violent causes to join on the internet. A solid containment plan for infectious-disease pandemics eludes us still.

Climate change is the ultimate threat—one largely unaddressed by the Trump administration. This is homeland-security malpractice. By withdrawing from the Paris Agreement in 2017, the United States now finds itself isolated, in the same company as Syria and Nicaragua, the only other countries in the world not to ratify the global accord to limit global warming to well below 2 degrees Celsius above preindustrial times.

To safeguard the American people, as my former department’s mission demands, we must also look beyond the nominal limits of “homeland” security. We should repair the alliances and partnerships that are essential to our homeland security in an ever more dangerous world. We should help alleviate the conditions in Central America that cause so many to flee to the United States. We should inventory all of our existing intelligence-sharing agreements so that we can identify gaps to fill and areas that need strengthening. We should challenge the community of nations to work collectively to establish enforceable standards governing cybersecurity. The United States must reengage and reassert our leadership position in the world.

Our current path is built on a false security narrative—security theater run amok. And Americans are left in a state of unbearable anxiety, seeing threats in the wrong places and ignoring others in front of their eyes.

Excerpted from How Safe Are We?: Homeland Security Since 9/11, by Janet Napolitano with Karen Breslau. Copyright © 2019. Available from PublicAffairs, an imprint of Perseus Books, LLC, a subsidiary of Hachette Book Group, Inc.