President Donald Trump tweeted late Tuesday that he would "revisit" his decision to end the DACA program for illegal immigrants brought to the U.S. at a young age if Congress cannot come up with an alternative.

Attorney General Jeff Sessions announced that the Trump administration was phasing out the Deferred Action for Childhood Arrivals program, saying that former President Barack Obama didn't have the authority to enact the policy in June 2012.

Hours after his announcement, Trump expressed compassion for for those who would lose deportation protection and the ability to work legally in the U.S.

"I have a love for these people and hopefully now Congress will be able to help them and do it properly," Trump told reporters at the beginning of a meeting with top Republicans on tax policy, adding that he was not in favor of punishing children for the actions of their parents.

"In effect, I am not going to just cut DACA off, but rather provide a window of opportunity for Congress to finally act," the president said. "Young Americans have dreams, too."

Not long after he made those comments, at the beginning of a meeting at the White House with top Republicans on tax policy, the president tweeted that he wants any legislative fix to make citizens the priority.

White House Press Secretary Sarah Huckabee Sanders said the president would look to Congress to pass a "responsible immigration reform package" with money to control the border with Mexico and better protect American workers' jobs — along with protecting the so-called "dreamers" covered by DACA.

Senate Majority Whip John Cornyn, R-Texas, the No. 2 Senate Republican, said if Trump truly wants a comprehensive immigration reform package, including a solution for the 11 million immigrants in the country illegally, he's certain to be disappointed. Congress tried that and failed in 2013, and GOP leaders immediately ruled it out Tuesday.

"Guaranteed failure," Cornyn said.

If the goal is a more incremental package that combines a solution for the "dreamers" with steps such as visa reforms and enhanced border security, "there may be a deal to be had," Cornyn said.

Sanders' blunt warning to lawmakers skeptical they can come up with a plan: "If they can't, then they should get out of the way and let somebody else take their job that can actually get something done."

Trump's aides painted his move to gradually phase out the program as the best of bad options: State officials had threatened a lawsuit if he did not act by Tuesday to repeal the program, which has given nearly 800,000 young immigrants a reprieve from deportation and the ability to work legally in the U.S. in the form of two-year, renewable work permits.

Under the phase-out plan announced by Sessions, the Department of Homeland Security was halting acceptance of new applications under DACA as of Tuesday. People with permits set to expire between now and March 5, 2018, will be able to re-apply as long as their applications are submitted by Oct. 5. Existing permits will remain in effect, and applications already in the pipeline will be processed.

That means the earliest that dreamers would begin to lose protections under the program would be next March.

Trump's action nonetheless drew swift criticism from immigration advocates, Democratic lawmakers and business and religious leaders who had urged Trump to spare the program.

Obama slammed the decision as "wrong," ''self-defeating" and "cruel."

House Minority Leader Nancy Pelosi, D-Calif., called it "a deeply shameful act of political cowardice and a despicable assault on innocent young people in communities across America."

Some Republicans objected, too.

Sen. John McCain, R-Ariz., said Trump was taking "the wrong approach," and he added: "The federal government has a responsibility to defend and secure our borders, but we must do so in a way that upholds all that is decent and exceptional about our nation."

One bill addressing the issue that has received significant attention, introduced by Sens. Lindsey Graham, R-S.C., and Dick Durbin, D-Ill., would allow young immigrants who grew up in the U.S. to earn lawful permanent residence and eventually American citizenship if they complete a list of requirements.

The president, Graham declared, must "work the phones ... try and get a consensus here."

"From a Republican Party point of view, this is a defining moment," he said.

The Associated Press contributed to this report.