Although initially against DACA, President Trump has signaled this group could be spared from deportation. (Meg Kelly,Claritza Jimenez/The Washington Post)

President Barack Obama’s advisers knew he was taking a political risk when he entered the Rose Garden in June 2012 to announce plans for allowing young undocumented immigrants, known as “dreamers,” to stay in the country and work without the threat of being deported.

Obama’s announcement amounted to a last resort, a sweeping use of executive power in the face of opposition from a Republican Congress. All presidents have used their authority to unilaterally change policies, but such an action had never been tried with immigration at this scope — granting deportation relief and renewable, two-year work permits to hundreds of thousands of immigrants brought to the country illegally as children.

Five years later, Deferred Action for Childhood Arrivals has been, by many measures, an unqualified success. Nearly 800,000 immigrants have enrolled, and most have already renewed their protected status. Polls show widespread public support for the dreamers. Forty-five percent of DACA recipients are attending school, while those in the workforce have seen their wages rise from an average of $10.29 per hour to $17.46, according to the Center for American Progress.

There is just one problem: The program was never meant to be permanent. And, in a cruel irony for those enrolled, DACA’s success could lead to its undoing.

Buoyed by the program’s achievements, Obama moved in November 2014 to use more executive power to create another deferred-action program for an additional 4 million immigrants, a decision made despite his own repeated public disavowals of the power to do so.

A young woman, who was brought to the U.S. as a teenager, overstayed her visa to get an education. Now she worries what will happen if President Trump repeals DACA. (Whitney Shefte/The Washington Post)

That action opened the door for Texas and other Republican-controlled states to sue, and they won an injunction from a federal judge in 2015 that remains in place after the Supreme Court deadlocked 4 to 4 last year.

Now, Texas and nine other states have set a Tuesday deadline for the Trump administration to rescind DACA or face a similar legal challenge.

That has put Trump — who ran as an immigration hard-liner but has wavered over DACA since taking office — in a political bind and prompted fears among advocates that he will begin unwinding the program as soon as Friday.

The president has promised to “show great heart” in his decision and is reportedly torn by conflicting advice from senior aides. Immigration hard-liners, such as senior policy adviser Stephen Miller and Attorney General Jeff Sessions, want to end DACA. Others, including Chief of Staff John F. Kelly, who previously served as homeland-security secretary, consider it a political liability for Trump to terminate the program.

Meantime, the looming deadline has prompted widespread outcry.

“We have a crisis of confidence,” said Tom Tait, the Republican mayor of Anaheim, Calif., and a co-chair of the U.S. Conference of Mayors’ immigration task force, which supports DACA. “A promise was made to them to come out of the shadows to work and go to school and pursue the American Dream.”

The situation also has laid bare a difficult truth for Obama — that his decision to govern largely through executive power in his final years in office was done at the risk that his legacy could be quickly undone by his successor.

Immigration advocates and supporters attend a rally and march to Trump Tower in New York City on Wednesday in support of the Deferred Action for Childhood Arrivals program, or DACA. (Spencer Platt/Getty Images)

Obama has learned that lesson repeatedly — in Trump’s withdrawal of the United States from a global climate deal and an Asia trade pact and his rollback of financial and environmental regulations. But nowhere is the pain more acute and personal than for the dreamers, who rejoiced over DACA but who are suddenly staring at a bleaker, more uncertain future.

They turned over personal information to the government, including their home addresses, to register for their work permits — but they now face the prospect that this information could lead to their apprehensions or deportations.

Senior Trump administration officials have said they are not targeting dreamers. But the National Immigration Law Center has been inundated with calls from DACA recipients asking whether they should consider moving, said Executive Director Marielena Hincapié.

“At the end of the day, people need to make informed decisions over their assessment of risk,” she said.

Former Obama administration officials said they always recognized that a Republican administration could roll back the program and that it was intended as a temporary patch until Congress approved the first major comprehensive immigration legislation since President Ronald Reagan signed a bill into law in 1986.

“It is absolutely a muscular use of enforcement authority,” said Cecilia Muñoz, who was Obama’s domestic policy adviser. “We did a lot of careful work and felt we could defend it legally. But there was a lot of soul-searching about whether it could hold up politically.”

In 2011, the Department of Homeland Security had undertaken a massive review to try to speed up an immigration-court backlog of nearly 400,000 cases, offering administrative closure to tens of thousands of undocumented immigrants that would have provided deportation relief. But many rejected the offer because it did not include a work permit, said John Sandweg, a former DHS senior official who was involved in the process.

Aides informed then-Homeland Security Secretary Janet Napolitano that about 3,000 of the cases involved dreamers who would have qualified for a path to citizenship under the 2010 Dream Act that was defeated in the Senate. The aides recommended offering this group deferred action, which would allow them to work.

Napolitano countered that they should expand the pool to all qualified dreamers.

“I remember being stunned. That would be a massive program,” Sandweg recalled this week. “She said: ‘If we just offered it to the ones who are caught, you’ll have dreamers trying to be arrested, and that does not make sense. If we do it, do it for all and fix the problem.’ ”

Napolitano pitched the idea to then-White House counsel Kathryn Ruemmler, who brought in Muñoz and then-Chief of Staff Jack Lew. The White House, under mounting political pressure from Latinos in an election year, had already been mulling similar ideas, former Obama aides said, and quickly agreed to go forward. Less than two weeks later, Obama announced DACA in a Rose Garden ceremony, on June 15, 2012.

“Let’s be clear: This is not amnesty. This is not immunity. This is not a path to citizenship. It’s not a permanent fix,” Obama said. “This is a temporary stopgap measure that let’s us focus our resources wisely while giving a degree of relief and hope to talented, driven, patriotic young people.”

The announcement was punctuated when Obama was interrupted by a reporter from the Daily Caller, a conservative news website, who shouted a question about what it meant for American workers. Obama chided him but later answered, saying DACA was “the right thing to do for the American people. And here’s the reason — because these young people are going to make extraordinary contributions.”

White House aides feared the political blowback, but it was relatively minimal. Obama won more than 70 percent of the vote among Latinos and Asian Americans in sweeping to reelection over Republican Mitt Romney.

Over the ensuing two years, however, an effort on Capitol Hill to pass a comprehensive immigration bill died in the GOP-controlled House.

Pressure from advocacy groups mounted again on Obama, who protested repeatedly that he did not possess the power to expand DACA. The legal underpinnings were based on a concept, known as “prosecutorial discretion,” that law enforcement agencies with limited resources must set priorities, and White House aides feared that expanding it would undermine that rationale.

Days after Republicans gained control of the Senate in the 2014 midterms, however, Obama announced plans to create another deferred-action program for up to 4 million immigrant parents of U.S. citizens.

It never happened. Texas and 25 states sued, and U.S. District Judge Andrew S. Hanen of Brownsville, Tex., issued an injunction a day before the program was to begin.

Looking back, even some Democrats said Obama’s move was a mistake. The issue became fodder in the 2016 presidential race. Trump called deferred action unconstitutional, while Democrat Hillary Clinton promised to go further than Obama had.

Expanding deferred action beyond the dreamers meant the administration was unilaterally implementing a “policy that is pretty broadly not only not permitting immigration enforcement but is doing 60 percent of the work of a comprehensive reform bill,” said Leon Fresco, an immigration lawyer who served as an aide to Sen. Charles E. Schumer (D-N.Y.). “That’s where it may be overreach.”

Dreamers said that despite their fears over DACA’s future, they have no regrets in their strategy. Cristina Jiménez, executive director of United We Dream, called DACA the “most significant immigrant rights victory in 30 years.” But she emphasized it was never the “end goal.”

“For our community, the undocumented, the solution needs to be permanent,” she said, “and it needs to be delivered by Congress.”