The White House on Sunday night appeared to scuttle a deal on so-called Dreamers—undocumented immigrants who came to the United States as children—when it released a series of largely conservative policies that it wanted included in the final package.

Top congressional Democrats immediately denounced the proposals as poison pills, meant to undermine efforts to codify an Obama-era program to shield Dreamers from deportation, dubbed Deferred Action for Childhood Arrivals.

But though they were caught off guard by the announcement, the signs were certainly there beforehand.

For weeks, top officials to the president have been working behind the scenes to upend a DACA deal that President Trump had been struck with Senate Minority Leader Chuck Schumer and House Minority Leader Nancy Pelosi. And spearheading the campaign of behind-the-scenes impairment was White House senior policy adviser Stephen Miller.

A need for a deal had been necessitated by the Trump administration’s decision to end DACA over the course of six months. But in the weeks after that decision was made, the president, along with Schumer and Pelosi agreed to a framework to protect DACA recipients in exchange for enhanced border security measures that notably did not include funding a border wall, Miller got to work.

Miller, a staunch immigration hawk, was conspicuously left out of the bipartisan dinner meeting where that DACA framework had been formed. By the morning after the dinner, Miller, sources say, was already in discussions with Capitol Hill offices about how to ensure conservative policy gains ended up in the final deal his boss might cut.

A hard-lined anti-immigration advocate, Miller strategized with Sen. Tom Cotton (R-AR) about a more specific, more conservative, set of extractions the White House would demand in the deal. Cotton was the natural choice—he is one of the Senate’s most conservative members on the immigration issue, and the co-author of legislation, dubbed the RAISE Act, to significantly limit the number of legal immigrants to the U.S.

“They’ve been in close and constant contact on DACA and RAISE,” a source familiar with their discussions told The Daily Beast. Policies in line with Cotton’s legislation formed a key portion of the legislative “principles” released by the White House on Sunday.

Discussions between Cotton and Miller continued after last month’s meeting, the source said. According to Caroline Rabbit, Cotton’s spokeswoman, the senator “was and is in contact with numerous people in the administration about immigration policy.” She described the discussions as broader than the Miller backchannel. “I think it’s more accurate to characterize it as he extensively consulted with the [White House] on immigration as a whole over the last few several months,” she said.

When asked about these talks several weeks ago, White House press secretary Sarah Huckabee Sanders downplayed their significance. “The administration is working on a reform plan and relevant staff are engaging the hill,” she said in an email. “Separately the President mentioned Cotton and Perdue in his DACA statement in terms of reform priorities so there isn’t really any news here.”

On the Hill, however, Democrats were acutely aware of Miller’s presence and thought of it as an ominous sign. They just didn’t think that Miller had rank over the other Trump White House official with whom they were speaking. As one Democratic aide told The Daily Beast, both Schumer and Pelosi had been in touch with chief of staff John Kelly several times since the DACA-deal dinner. “Schumer also spoke to the president about it once urging him to move forward with the negotiations,” the aide said.

That Miller operated largely out of view was by design. Multiple sources in the Trump White House tell The Daily Beast that he is acutely aware of how other senior Trump aides—including former chief strategist Steve Bannon, another immigration hardliner—have been banished to the doghouse by President Trump for assuming too large a public profile.

Miller worries about being portrayed as the true master of Trump’s immigration policy—a “President Miller” capable of vetoing any “deal” the actual president might strike with Democratic leaders—and has operated more carefully and less ostentatiously than someone like Bannon.

“He actively fears becoming that… [and] goes to great lengths to avoid the ‘Bannon overlord’ image that killed Bannon” in the Trump White House, one of Miller’s West Wing colleagues told The Daily Beast. “The last thing he wants is for the president to see him as some showboat.”

Despite those efforts, Miller remains a fascination of the press corps (The New York Times was the latest publication to pen a lengthy profile of the aide on Monday) and a much-recognized policy force inside the White House. Top aides describe him as integral to the president’s domestic policy agenda, immigration in particular.

“We have this running joke that if we were going to get key man’s insurance on anyone, Stephen would top the list,” Kellyanne Conway, counselor to the president, told The New York Times for that profile.

Miller did not respond to a request for comment. Other officials spoke on the condition of anonymity in order to speak freely about ongoing deliberations.

Even as Miller took a behind-the-scenes approach on the Hill, the White House maintained a steady dialogue with conservative members who will be key to any legislative effort to replace DACA. Leading the effort was Marc Short, the White House’s director of legislative affairs, who kept in touch with Rep. Mark Meadows (R-NC), the chair of the influential House Freedom Caucus.

A House Republican source said Meadows also sat down with other senior officials pressing for a workable and passable DACA replacement. The North Carolina Republican has “talked to several senior [White House] officials [about] DACA,” the Hill source said. “Not one in particular, but there was desire for conservatives to put on paper what they’d like to see.”

Over the past week, the fruits of those discussions became apparent. The administration began settling on a set of proposals to demand in exchange for giving legal protection to Dreamers. They included the RAISE Act, along with funding for a wall along the southern border and a mandate for employers’ use of technology to verify workers’ immigration statuses,

On Tuesday, the White House told Democratic leaders that it would send their principles to congressional leadership of both parties by Friday afternoon. They didn’t come. On Sunday, Pelosi and Schumer’s office were informed of it by their contacts with the Department of Homeland Security, aides said. They got a more specific rundown through press accounts and by listening in to a call with Short and other administration officials.

One top House aide called the roll out and the package itself “ridiculous.”

“We wouldn’t even trade this for legalizing 11 million people,” the aide said. “The point that was made in the dinner meeting was that the DREAM Act only covers a small portion of the 11 million [undocumented immigrants in America]. So we should be talking about a border security proposal; not interior enforcement and certainly not a wall.”

DACA recipients will begin to lose their tentative legal statuses on March 5, 2018.