WASHINGTON (AP) — Former President Barack Obama on Tuesday called the Trump administration's decision to repeal a program protecting young immigrants from deportation "cruel" and "self-defeating." He urged Congress to pass a bill fixing the situation "with a sense of moral urgency."

In a Facebook message, Obama said repealing the program casts a shadow over some of the nation's best and brightest young people.

"To target these young people is wrong - because they have done nothing wrong," he wrote.

The former president's statement came as President Donald Trump announced that the Deferred Action for Childhood Arrivals, or DACA, program will end in six months.

During his campaign, Trump slammed the program, saying shielding immigrants brought to the United States illegally when they were children from deportation was illegal "amnesty." Trump and his supporters, including Attorney General Jeff Sessions, have called it unconstitutional.

DACA has provided 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.

The Obama administration created the DACA program in 2012 as a stopgap as they pushed unsuccessfully for a broader immigration overhaul in Congress. Many Republicans say they opposed the program on the grounds that it was executive overreach.

Legislation to legalize the so-called Dreamers has been lingering in Congress for years. Obama called anew on Congress to pass an immigration bill "with a sense of moral urgency that matches the urgency these young people feel."

The former president added that deporting DACA recipients does not make sense, since "kicking them out won't lower the unemployment rate, or lighten anyone's taxes, or raise anybody's wages."

"It is self-defeating - because they want to start new businesses, staff our labs, serve in our military, and otherwise contribute to the country we love," Obama said. "And it is cruel. What if our kid's science teacher or our friendly neighbor turns out to be a Dreamer? Where are we supposed to send her? To a country she doesn't know or remember, with a language she may not even speak?"