President Donald Trump signaled Tuesday that he may accept some sort of legal status for “Dreamers” enacted by Congress in return for lawmakers’ strengthening of immigration law, including merit-based reforms.

“We will resolve the DACA issue with heart and compassion–but through the lawful Democratic process,” @POTUS says.

In a statement issued after Attorney General Jeff Sessions announced the gradual end of protections for so-called Dreamers, those brought illegally to the U.S. as children, Trump called for Congress to “advance responsible immigration reform that puts American jobs and American security first.”

The president specifically mentioned a merit-based system for legal immigration and reforms to the issuing of green cards allowing immigrants to live and work here permanently.

Currently, Dreamers are allowed to work and are protected from deportation under a program unilaterally ordered in 2012 by President Barack Obama, called Deferred Action for Childhood Arrivals, or DACA.

“We will resolve the DACA issue with heart and compassion– but through the lawful Democratic process–while at the same time ensuring that any immigration reform we adopt provides enduring benefits for the American citizens we were elected to serve,” Trump said in the statement, capitalizing the D in democratic. “We must also have heart and compassion for unemployed, struggling, and forgotten Americans.”

DACA shields from deportation those who were minors when their parents brought them to the country illegally, a population their advocates call Dreamers. Critics slammed the Obama policy as an unconstitutional amnesty for illegal immigrants.

In 2012, while Obama was running for re-election, his Department of Homeland Security adopted Deferred Action for Childhood Arrivals. This came after Congress did not pass versions of the DREAM Act, which would have bestowed legal status on illegal immigrants brought to the United States as children.

Trump noted that new applications for work permits under DACA–which allowed for temporary work permits, a Social Security card, and other benefits–won’t be accepted but all existing permits will be honored until they expire. Some permits will not expire for another two years, he said.

Also, the president said deportation priorities remain on security threats, visa overstays, and repeat violators.

“I have advised the Department of Homeland Security that DACA recipients are not enforcement priorities unless they are criminals, are involved in criminal activity, or are members of a gang,” Trump said.

Attorney General Jeff Sessions announced an “orderly wind-down” of DACA, giving Congress time to address a policy that he said wouldn’t likely survive a court challenge in its current form.

But, Sessions added during his remarks Tuesday at the Justice Department:

The compassionate thing is to end the lawlessness, enforce our laws, and, if Congress chooses to make changes to those laws, to do so through the process set forth by our Founders in a way that advances the interest of the nation. … As a candidate, and now in office, President Trump has offered specific ideas and legislative solutions that will protect American workers, increase wages and salaries, defend our national security, ensure the public safety, and increase the general well-being of the American people. He has worked closely with many members of Congress, including in the introduction of the RAISE Act, which would produce enormous benefits for our country. This is how our democratic process works.

After the Sessions announcement, the White House issued a press release saying “DACA made it impossible for President Trump to pursue the reforms needed to restore fairness to our immigration system and protect American workers,” and specifying priorities such as a merit-based system to replace chain migration, improving vetting of immigrants, and controlling the southern border. Chain migration allows a continuous “chain” of relatives to enter the country if they are related to current legal residents.

In August, Trump announced his support for legislation to establish a system that would give preference to skilled workers to fill needed jobs while also capping annual legal immigration totals.

That bill, called the Reforming American Immigration for Strong Employment Act, or RAISE Act, is sponsored by two Republican senators, Tom Cotton of Arkansas and David Perdue of Georgia.

Meanwhile, Sens. Lindsey Graham, R-S.C., and Dick Durbin, D-Ill., sponsored a bill to codify DACA, granting legal status to the illegal immigrants brought to the country as children. So far, about 800,000 illegal immigrants have benefited from DACA.

“From Sessions’ speech, the administration is seemingly open to some type of combination bill,” David Inserra, a homeland security policy analyst for The Heritage Foundation, told The Daily Signal. “The RAISE Act seemed to be floated as a condition for keeping DACA.”

Elaine Duke, acting secretary of the Department of Homeland Security, initiated the process for rescinding DACA and its protection for Dreamers, Sessions said in his announcement.

“This will enable the Department of Homeland Security to conduct an orderly change and fulfill the desire of this administration to create a time period for Congress to act should it so choose,” Sessions said. “We firmly believe this is the responsible path.”

Referring to Obama’s unilateral action allowing Dreamers to work without fear of deportation, Sessions added: “Simply put, if we are to further our goal of strengthening the constitutional order and the rule of law in America, the Department of Justice cannot defend this overreach.”

Sessions didn’t specify how long the orderly phaseout would be, but some news organizations, citing administration sources, reported it would be six months.

During the 2016 campaign, Trump pledged an immediate end to DACA, but softened on the policy after becoming president. So the announcement Tuesday represents a compromise of sorts, pledging that the executive version of DACA will end while giving Congress a chance to codify the policy.

The decision toes a line that allows the president to keep a campaign promise, while abiding by what much of official Washington called for him to do.

House Speaker Paul Ryan, R-Wis., said Friday that he opposed ending DACA, and that he hoped Congress could have time to do a legislative fix. In a statement Tuesday, Ryan said Obama’s action wasn’t a permanent solution to the question of children brought to the country illegally:

Congress writes laws, not the president, and ending this program fulfills a promise that President Trump made to restore the proper role of the executive and legislative branches. But now there is more to do, and the president has called on Congress to act. The president’s announcement does not revoke [work] permits immediately, and it is important that those affected have clarity on how this interim period will be carried out. … It is my hope that the House and Senate, with the president’s leadership, will be able to find consensus on a permanent legislative solution that includes ensuring that those who have done nothing wrong can still contribute as a valued part of this great country.

Graham, often one of Trump’s harshest Republican critics and co-sponsor of the legislation to protect Dreamers, seemed supportive of the president’s decision.

“I have always believed DACA was a presidential overreach,” Graham said in a statement Monday. “However, I equally understand the plight of the Dream Act kids who–for all practical purposes–know no country other than America.

“I look forward to working with President Trump and my colleagues in Congress to find a fair solution to this difficult problem,” Graham said.

However, Senate Majority Leader Charles Schumer, D-N.Y., came out strongly against Trump via Twitter:

The Trump administration’s invitation for Congress to act did not meet with immediate opposition from immigration hawks, including the leader of Numbers USA, an organization advocating deportation action against illegal immigrants and reduced legal immigration.

“President Trump has delivered a wonderful Labor Day present to unemployed American millennials by ordering the end of former President Obama’s unconstitutional issuing of work permits under the DACA amnesty,” Numbers USA President Roy Beck said in a prepared statement. “Now it is time for Congress to focus on strong immigration enforcement measures and reforms to our legal immigration system that put American workers first.”

Key to the timing of the decision was the looming threat of a lawsuit against the federal government by state attorneys general led by Texas Attorney General Ken Paxton.

The 10 attorneys general gave the Trump administration a Sept. 5 deadline to revoke DACA, at which point it either would withdraw the lawsuit or proceed with the suit. (Tennessee’s attorney general withdrew from the challenge last week, leaving nine.)

“As the Texas-led coalition explained in our June letter, the Obama-era program went far beyond the executive branch’s legitimate authority,” Paxton said in a prepared statement Tuesday. “Had former President Obama’s unilateral order on DACA been left intact, it would have set a dangerous precedent by giving the executive branch sweeping authority to bypass Congress and change immigration laws.”

Shortly after Democrats lost their Senate majority in the 2014 elections, Obama expanded the principle to include parents of the DACA beneficiaries, with a program called Deferred Action for Parents of Americans and Lawful Permanent Residents, or DAPA.

After states sued, courts rejected that action, asserting the executive branch doesn’t have the solitary power to grant legal status to immigrants. The Supreme Court deadlocked on DAPA in 2016, leaving in effect a 5th Circuit Court of Appeals decision upholding an injunction that blocked the policy.

In June, citing the rulings, then-Homeland Security Secretary John Kelly revoked the 2014 memo authorizing the second amnesty program. Kelly, now Trump’s chief of staff, said at the time that DACA would remain in effect.

“If we were to keep the Obama administration’s executive amnesty policy, the likeliest outcome is that it would be enjoined just as was DAPA,” Sessions said.

Heritage Action for America CEO Michael Needham noted that the move could serve as a warning about executive actions, saying:

The Trump administration deserves credit for beginning the process of slowly unraveling the unlawful DACA program put in place by the previous administration. It should serve as a reminder for Republicans and Democrats alike that executive action can be reversed by executive action. Moving forward, it is imperative the executive and legislative branches work together to build a national consensus for an immigration policy that makes sense for 320 million Americans, not only a sympathetic group put into an untenable situation because former President Obama illegally bypassed Congress.