As white supremacist terror attacks have left dozens dead around the United States, the Department of Homeland Security has faced blistering criticism for its approach to the threat. Earlier this year, however, congressional Democrats declined to make more money available for the department’s efforts to thwart domestic terrorist attacks.

Their reason, in part: concern the Trump administration could use new money to target American Muslims instead of white supremacists.

It’s a complex episode of a messy fight between Trump’s Department of Homeland Security and the Democratic-controlled House of Representatives—a fight with tens of millions of dollars at stake. And it didn’t have to happen.

When Trump came into office, his Office of Management and Budget didn’t ask Congress for money for a small grant program DHS used to fund efforts to counter domestic terrorism. A source familiar with the department’s efforts said there were concerns that some of the grants provided by DHS at the end of the Obama administration to help prevent attacks by homegrown violent extremists were inefficient and failed to address the threats adequately.

After two years without funding, DHS officials decided to go straight to congressional appropriators to request the money instead of going through the White House. Per one congressional source familiar with the request, they asked for more than $17 million—$10 million to offset the grant money that existed under the Obama administration, plus about $7 million more. They made the ask in recent weeks.

But House appropriators didn’t bite, and declined to include that money in a recent funding bill. They worried, according to half a dozen sources familiar with the talks, that DHS doesn’t have a cohesive strategy for fighting domestic terror—a concern a DHS official said is unwarranted. And the White House has yet to release a clear strategy document on the growing threat, instead just having officials characterize it in speeches and congressional testimony. Four of those sources specifically said that concerns about potential anti-Muslim programs informed Democrats’ reticence to provide the new funds.

And the request’s timing didn’t help. One Democratic aide said the committee had already written a bill funding the department for 2020 by the time the request came in. DHS submitted its request in the spring, the aide said.

“The department requested funding for these grants under the Obama administration, but there was a [concern] that under Trump [the grants] would be used in the new administration to fuel anti-Muslim programming and rhetoric,” a House Democratic aide told The Daily Beast.

“ The Trump administration’s emphasis has been placed on addressing the potential for violence by immigrants... But the primary threat facing us comes from people here who become radicalized by what they see online. ” — former DHS official John Cohen

A DHS official strongly disagreed with this characterization. “DHS is committed to protecting the homeland by working to prevent all types of violent extremism,” this official told The Daily Beast. “The department rejects the premise that its prevention programs have or would target Muslims.”

In testimony in front of Congress in June, Elizabeth Neumann, the assistant secretary for Threat Prevention and Security Policy, the division that oversees programs to prevent domestic terrorist attacks, said the tactics used by homegrown violent extremists make it “extremely difficult for law enforcement to detect and thwart potential attacks.”

The DHS request came as the Trump administration began to push a new strategy regarding security at the southern border. Over the past year, the White House and DHS have pushed for more resources to try to slow an influx of Central American migrants.

In May, the White House requested $4.5 billion in emergency border funding from Congress, more than $3 billion of which would go to humanitarian efforts. President Trump reportedly requested the additional funding for the border because the money the administration previously received from the Department of Defense came with several restrictions and limitations. The House voted Tuesday to approve the supplemental funding.

And over the weekend, Trump postponed nationwide raids to deport undocumented families after threatening to send Immigration and Customs Enforcement agents out on the streets if Democrats on Capitol Hill did not agree to changes in asylum law.

Meanwhile, Homeland Security has drawn criticism for its handling of election security and domestic terrorism issues. The Daily Beast reported the department this year shuttered a group within its intelligence arm focused on analysis of domestic terrorism. It also gutted two task forces focused on election security and foreign interference.

On top of that, headquarters has asked each Homeland Security component to send volunteers away from their day jobs and to the border. The department’s agency responsible for protecting America’s vital infrastructure—including election systems—struggled to initially fulfill the request and had to send out more than one request for volunteers. Democrats and other outside observers say the White House’s decision to prioritize border security over other core DHS missions leaves the country at risk.

“The Trump administration’s emphasis has been placed on addressing the potential for violence by immigrants and others outside of this country,” said John Cohen, the former deputy undersecretary for intelligence and analysis at DHS. “ But the primary threat facing us comes from people here who become radicalized by what they see online. So, any effort to protect this nation has to focus on the domestic environment as opposed to being obsessed by that potential violence that feeds the administration’s anti-immigration agenda.”