Conservative lawmakers led Sen. by Thom Tillis are crafting a bill they call the conservative Dream Act that would provide a path to permanent residency to people brought here illegally as children, offering President Donald Trump an escape hatch on one of his most vexing immigration challenges.

The legislation creates an avenue for Trump to both fulfill a campaign promise to end the Obama-era Deferred Action for Child Arrivals program, or DACA, while yielding to what appears to be his personal desire to let these immigrants remain in the country.

"Who cares about DACA if there's a Dream Act," said a Republican involved with the policy negotiations and aware of Tillis' plan.

Trump has wrestled with the politics versus the personal on this issue since Inauguration Day, recognizing that whatever he decides to do about the roughly 800,000 DACA recipients will anger many and shape his legacy.

It was a year ago this week that, as a candidate, Trump promised supporters in Phoenix that he would scrap what he called an "illegal amnesty" program. But his tone changed dramatically once he became president, and he publicly shared his reluctance to put so many young people in line for deportation.

Trump is expected to end DACA as soon as Friday, but allow those who have received work permits to keep them until they expire, according to multiple people familiar with the policy negotiations.

The Tillis plan makes killing the deferred action program much more politically palatable. Republicans involved in the policy negotiations said Trump can claim a win with both his base for ending the program and with young immigrants, for whom he promised to try to "work something out."

Details are still being hammered out, but the Tillis plan would be a companion proposal to a House bill introduced by Rep. Carlos Curbelo, R-Fla.

Like Curbelo's bill, the Tillis plan would offer an eventual path to U.S. citizenship for immigrants who entered illegally before Jan. 1, 2012, and were 16 years old or younger.

The proposal would grant high school graduates without a serious criminal record conditional immigration status for a five-year period. During that time, if they earn a higher education degree, serve in the military or stay employed, they could apply for permanent residency and, eventually, citizenship.

About 2.5 million immigrants would be eligible.

"It really is the conservative dreamer bill," said a congressional source familiar with the plan.

Immigration advocates have sought to pass a measure for more than a decade; the DREAM (Development, Relief and Education for Alien Minors) Act had many of the same elements as DACA, but members of Congress have never been able to get enough support to pass the proposal.

Packaging the proposal as a Republican plan, which has more stringent requirements, supporters expect Tillis' plan will have a much better chance of passing than past bipartisan proposals that have failed.

A Republican involved with the policy negotiations and aware of Tillis' conversation with the White House said the North Carolina senator's proposal would allow Trump to be rid of the DACA program and still call it a win.

Groups that have opposed protecting Dreamers acknowledge a legislative proposal would make things easier for Trump to end the DACA.

"A legislative Dream Act would supplant the need for DACA. It wouldn't be an issue at all," said Ira Mehlman, a spokesman with the Federation for American Immigration Reform, a group that advocates for tighter immigration restrictions and is in talks with the administration.

The bill will receive pushback. Curbelo drew opposition from United We Dream, a youth-led immigrant advocacy organization that called the bill a "symbolic" gesture to try to score political points in an election year. But other pro-immigration reform groups, including the conservative National Immigration Forum, supported it.

In February, Trump promised to treat DACA recipients "with heart." But Trump has watched his poll numbers plummet amid multiple scandals and failed legislative initiatives that have besieged his presidency.

Citing the poll numbers, Chris Chmielenski, NumbersUSA's director of content and activism, said Trump needs to do everything he can to hang on to the support of his base.

"His base is the only thing he has going for him right now," Chmielenski said. "And this would appease his base."

In July, aboard Air Force One en route to Paris, Trump acknowledged he was still agonizing over what to do.

"It's a decision that I make and it's a decision that's very, very hard to make," Trump said. "I really understand the situation now. I understand the situation very well. What I'd like to do is a comprehensive immigration plan. But our country and political forces are not ready yet