Moments before delivering the State of the Union address, President Trump signed an executive order Tuesday to keep open one of the government's most criticized facilities: The military prison in Guantanamo Bay, Cuba.

Disclosing the order in his joint address to Congress, Trump said he also directed Defense Secretary James Mattis "to re-examine our military detention policy."

"I am also asking the Congress to ensure that, in the fight against ISIS and al-Qaeda, we continue to have all necessary power to detain terrorists — wherever we chase them down," he said.

Trump's order reverses a directive signed by former president Barack Obama to close the facility that has been the subject of attack from human rights groups since the George W. Bush administration opened it in the wake of the 9/11 terrorist attacks.

Obama was never able to completely close the facility, partly because congressional Republicans blocked efforts to move particularly dangerous detainees who were considered future terrorist threats.

Bush moved nearly 500 detainees out of Gitmo to other countries during his time in office, and the Obama administration transferred nearly 200.

Today, 41 prisoners remain in the facility, down from a high of nearly 800.

Trump frequently pledged to keep open the Guantanamo Bay prison during his 2016 presidential campaign, saying at one point he wanted to fill it up with "bad dudes."

The order Trump signed Tuesday said, "the detention operations at the U.S. Naval Station Guantanamo Bay are legal, safe, humane, and conducted consistent with United States and international law."

Yet while Trump said the move fulfills a campaign promise, Trump in his first year chose to do deal with terror suspects much like the Obama administration: prosecuting them in civilian courts.

The Center for Constitutional Rights, which has been involved in lawsuits against Gitmo since it opened, said in a statement that the new order is "unsurprising given Trump’s deep-seated racism, his well-documented antipathy toward all Muslims, and his endless puffing and posturing."

The organization added that the courts will likely decided Gitmo's fate, and it "has filed a new legal challenge to the illegality and racism driving Trump’s Guantanamo policy and demanding detainees’ release."

– Kevin Johnson contributed