President Donald Trump on Tuesday scrapped a program that protects almost 800,000 immigrants who were brought into the United States illegally as children from deportation, ordering a phased-out dismantling that gives a gridlocked Congress six months to decide their fate.

Trump's action, announced by Attorney General Jeff Sessions, rescinds a program called Deferred Action for Childhood Arrivals, or DACA. The administration presented the move as necessary to show respect for the country's immigration laws, and said nobody covered by the program would be affected before March 5.

The program, created by former President Barack Obama, was supported by Democrats and many business leaders. Hundreds of people protested the decision outside the White House and Trump Tower in Manhattan.

"President Trump's decision to end DACA is a deeply shameful act of political cowardice and a despicable assault on innocent young people in communities across America,” said Nancy Pelosi, the top Democrat in the House of Representatives.

Trump's action, deferring the actual end of the program, effectively kicks responsibility for the fate of the Dreamers to Congress, which hasn’t been able to pass any major legislation since the president took office in January and has been bitterly divided over immigration in the past. Obama bypassed Congress and created DACA through an executive order in 2012.

Obama posted a scathing response to Trump's decision on DACA to his Facebook page Tuesday afternoon, defending his use of executive order to create the program and describing the president's actions as "cruel."

"Whatever concerns or complaints Americans may have about immigration in general, we shouldn’t threaten the future of this group of young people who are here through no fault of their own, who pose no threat, who are not taking away anything from the rest of us," Obama said in the statement.

In response to Trump's announcement, some Democrats vowed to work to pass the DREAM Act, which would establish qualifications for Dreamers to be granted permanent residency.

“President Trump’s action today is an affront to who we are as Americans. He is needlessly targeting children who know no other country as home than America,” said Sen. Kirsten Gillibrand. “Congress must lead where the president won't and pass the DREAM Act.”

“America is strongest when we come together and reject xenophobia. Congress must permanently protect Dreamers and reject Trump's bigotry,” Sen. Bernie Sanders wrote on Twitter.

House of Representatives Speaker Paul Ryan called on lawmakers to find a long-term solution for the young immigrants affected by the reversal of the program.

"At the heart of this issue are young people who came to this country through no fault of their own, and for many of them it’s the only country they know. Their status is one of many immigration issues, such as border security and interior enforcement, which Congress has failed to adequately address over the years," Ryan said.

Trump appeared determined to pressure U.S. lawmakers to act.

"Congress, get ready to do your job - DACA!" the president wrote on Twitter on Tuesday morning before the policy announcement was made.

A number of Democratic state attorneys general, including New York AG Eric Schneiderman, have threatened legal action to defend the program. Nine Republican state attorneys general, led by Texas, had threatened a legal challenge in federal court if Trump did not act to end DACA, which may have influenced his decision.

Local politicians in cities like New York have also spoken out against the end of DACA.

Mayor Bill de Blasio pledged to stand by Dreamers in a statement. 

“If you’re worried, know we are deploying legal services funding quickly across all five boroughs,” de Blasio said in a statement. “If you face legal problems, we’ll be right there with you.”

Deporting Dreamers “is truly reprehensible,” Public Advocate Letitia James said in a statement.

“New York City will do everything in its power to ensure DACA recipients and immigrants are able to safely remain in their home,” she said.

With Nicole Brown