For the “first time ever,” America has a serious plan to defend its homeland, Donald Trump said on Monday (Dec. 18), before pledging again to build a wall on the Mexico border and end visa programs that have made the US a cultural melting pot.

Rather than make the US more safe, though, Trump’s own obsession with immigration threatens to do the opposite, US security experts say.

The threat of terrorism in the US today is as high as it was in the 9/11 era. But America’s main agency for preventing terror attacks is being misdirected, security experts, law enforcement professionals, and government officials tell Quartz. Since Trump took office, top jobs have been left unfilled at the Department of Homeland Security, and the agency is being pushed into a dangerous pattern of focusing on immigration while ignoring real threats.

The issue is about to come to a head in Congress, which needs to approve DHS’s $44 billion budget (pdf) in coming weeks. Trump has proposed that DHS trim counterterrorism spending in order to fund the wall on the Mexican border, and new head Kirstjen Nielsen, who was nominated by the White House in October, is pushing his controversial anti-immigrant agenda in her first days in office.

She and the White House are ignoring the US’s real risk, critics say—domestic attackers. “Individuals who live in the US, and who become inspired by what they see through social media and on the internet” pose the country’s greatest danger, said John D. Cohen, former DHS acting undersecretary for intelligence and analysis, and counter-terrorism coordinator. “These people go on to commit mass attacks, but operate independently of any terrorist group,” Cohen said.

“From an ideological and resource perspective, the DHS has become overly focused, if not obsessed, with immigration and building a wall on the Southern border, to the detriment of other functions,” Cohen said, “particularly those that relate to the current terrorism threat the country faces.”

The US’s homegrown threat

The Department of Homeland Security was created after the terror attacks of Sept. 11, 2001, by pulling together over 20 other US agencies. The 240,000-person DHS does everything: securing the US borders, responding to hurricanes, training local police and law enforcement agents in identifying and stopping terrorists, and more.

When it comes to terror, DHS should focus inside the US borders, other agencies say. Homegrown violent extremists “clearly represent the most immediate and most ubiquitous threat to us here inside the United States on a daily basis,” Nick Rasmussen, the outgoing head of the US’s National Counterterrorism Center, said in November. “Most terrorists are either born or raised here, or only became radicalized well after they came to the Untied States,” he said.

Akayed Ullah, who exploded a crude homemade pipe bomb in the New York City subway system earlier this month, is part of that trend. Originally from Bangladesh, Ullah said he attempted the failed attack for the “Islamic State.” But he had been in the United States legally since 2011, long before the formation of ISIS, and doesn’t hail from one of the countries on the Trump administration’s travel ban. None of Trump’s immigration proposals before the attack would have stopped it.

To anti-terror experts, how and where the 27-year-old was radicalized is more important than his nationality or religion. Ullah started reading about ISIS online in 2014, and started looking up information about how to build explosive devices on the internet last year, according to the complaint filed against him (pg. 9).

And while ISIS-inspired incidents grab the most headlines in the US, they’re only part of the US’s terrorism problem. From the beginning of 2010 to the end of 2016, 263 events were identified as terrorism-related incidents or extremist crimes, according to TEVUS (login required) a database compiled by a national consortium between DHS and academics. Just 66 of those were linked to Islamic fundamentalism. The remainder were inspired by right-wing or left-wing political ideologies, or single issues like anger at a government agency.

Sometimes the other attacks are far more dangerous, yet get much less attention. Two days before Ullah’s failed bombing, 21-year-old William Edward Atchison started shooting into classrooms at a New Mexico high school, killing two students. For years, Atchison had “spent most of his days online, repeatedly posting threats of violence” on white nationalist sites, the Daily Beast reported. The Trump administration has not mentioned Atchison, or his victims.

Far right extremists have been attacking Americans for a long time—in total, from 1990 to 2016, rightwing extremists killed more than twice as many people in the US as Islamic extremists did (this excludes both the Oklahoma Bombing and the Sept. 11, 2001 attacks, which the DHS considers “outlier events”). They also killed many more law enforcement officials in that time period, a DHS and University of Maryland report says. And these counts don’t include mass shootings that don’t seem to have any political motive.

What violent extremists have in common

Whether they’re born in Texas or Bangladesh, and no matter what religion (or lack of) they grew up with, individuals who set out to kill a large number of people often share common characteristics, research shows. Preventing attacks relies on focusing on behavior. “If you differentiate by the motive, you lose sight of the bigger picture,” Cohen said.

These characteristics include:

A track record of violent behavior or low-level criminal activity

Involvement in dysfunctional relationships

A history of domestic violence

Disconnection from their community

Belief that they are victims of societal or community indifference

A pattern of life failures

Underlying mental health issues

“These are people who tend to feel like they have not achieved success in their lives,” Cohen said, then spend an “extraordinary amount of time viewing social media,” including using online material to help develop the attack and social media to communicate their plans. “We see this in nearly every case,” he said.

The FBI and local law enforcement have been working on ways to identify these individuals, before they try to hurt others, but it needs to do much more, experts say. “We need to make it a lot easier for communities and local leaders to play a role in that effort,” Rasmussen said.

White House officials have been using the Ullah incident as an example of why the US should end so-called “chain migration,” in which immigrants can be sponsored by relatives already in the US, as Ullah was. But they admitted last week they have no data to link immigrants who come to the US this way to increased radicalization, or to link immigrants in general to increased crime. In fact, immigrant populations have lower crime rates than US natives, several studies show.

Nevertheless, DHS director Nielsen’s three public events since Ullah’s attempted attack on Dec. 11 have been about trimming immigration, attacking sanctuary cities, and funding the border wall.

Funding Trump’s wall starves counter-terrorism

“If we don’t get the wall, you’re gonna have a lot of very unhappy people, starting with me,” Trump said during Nielsen’s swearing-in on Dec. 8. It was disconcerting for many of the DHS staff to hear, former and current employees tell Quartz, because funding the wall is coming at the expense of other departments that are supposed to keep Americans safe.

Trump’s proposed 2018 budget adds $4.7 billion to the DHS overall, but trims anti-terrorism funding by an estimated $600 million.

About $800 million in grant funding for state and local first responders for disasters and emergencies will be eliminated, members of Congress estimate. State and local governments will also be forced to match DHS funding for the “Urban Area Security Initiative,” effectively slashing millions in grants to police forces.

Trump’s budget also cuts the “Visible Intermodal Prevention and Response” program, which patrol airports, train stations, bus terminals, and special events like the Super Bowl, from 31 teams to eight. In 2019, the administration plans to eliminate these teams entirely.

The White House has already cut funding this year for the DHS’s Countering Extremist Violence program, eliminating funds for groups like “Life After Hate,” which tries to counter white supremacy.

Meanwhile, Trump has pledged to add thousands to the agency’s ranks of immigration and border patrol officers, and is asking for $1.6 billion this year for “bricks and mortar” to build a border wall that could ultimately cost as much at $20 billion, and could do little to stop crime, experts say.

Transportation Security Administration

DHS grants provide extensive resources to state and local law enforcement, and are crucial to the US’s threat prevention framework, said Mike Sena, president of the National Fusion Center Association, a group of 79 state and major urban area law enforcement and public safety threat identification, analysis and prevention organizations created after Sept. 11.

“There is no state and local training capability” for counterterrorism without federal grants from the DHS and DOJ, said Sena, who has more than 20 years of law enforcement experience. For the year ahead, “everyone is projecting less funding and fewer resources available,” he said.

Training to respond to active threats, like the situation at the Port Authority Subway bombing, is heavily reliant on funding from DHS, Sena said, as is training first responders to coordinate in large-scale incidents. “When you have multiple mass casualty victims, you need a plan to get emergency medical support to those people, otherwise they will bleed out,” Sena said.

But convincing politicians in DC that they should spend money on preventative training and resources can be difficult, Sena said, in part because “if we do our job effectively, nothing happens.”

Some members of Congress are signaling concern. The budget may be “overriding what local, state, and national leaders have told me they most need to keep us safe,” Claire McCaskill, the senator from Missouri, said Dec. 12. Americans need examine closely whether “[the wall] is the best place to put the money,” James Norton, an ex-DHS official during the George W. Bush administration, told Quartz.

Trump’s incendiary tweets and policies

Complicating US safety further are the Trump administration’s own statements and policies. The president’s attacks on Mexicans, Muslims, and African-Americans are helping to fuel a rise of hate crimes in the United States from white nationalists supporters, civil rights groups believe. Meanwhile, anti-Islamic policies and the Muslim travel ban are seen as provocations.

Rasmussen, the outgoing NCTC head, told reporters that the US’s anti-Muslim rhetoric makes fighting terrorism more difficult. “I don’t think it’s arguable it’s more difficult when the environment is contaminated by mutual suspicion,” he said.

Trump’s view on US terrorism seems to come from advisors like Stephen Bannon and Sebastian Gorka, who mistakenly believe that terror threats “stem from a global jihadist movement that is centralized,” Cohen says. “The problem is they are not looking at the information” available about past attacks and future threats, he said.

For law enforcement on the ground, it’s a confusing time. “It is a little disconcerting for law enforcement in the field when we hear we are a priority and number one—and then we see the proposed numbers,” Sena said.

“We know that we have to continually do our best to educate the administration and Congress on what law enforcement does,” he said, adding that he wished there were more people with law enforcement experience in the White House.