The Biden administration has transferred its first detainee out of the prison at Guantanamo Bay, the Pentagon said Monday, repatriating a Moroccan man whose release had been recommended in 2016 but whose detention continued under Donald Trump's presidency.

"The Department of Defense announced today the transfer of Abdul Latif Nasir from the detention facility at Guantanamo Bay to the Kingdom of Morocco," a Pentagon statement said, adding that 39 prisoners remain in the controversial facility.

Nasir was detained in 2002. He was never charged with any crime.

His transfer out of Guantanamo was first proposed by the Obama administration "subject to security and humane treatment assurances," according to the Pentagon, but had not taken place by the time Trump took office in 2017.

In Rabat, the public prosecutor's office announced on Monday the opening of "an investigation with the person concerned for his alleged involvement in the perpetration of terrorist acts."

"The legal effects will be determined by the prosecutor's office in the light of the results of the investigation," it added in a statement.

The influential US civil rights association the ACLU welcomed the news of Nasir's release, calling his years of detention a "travesty."

The US "urgently" needs to do the same for other cleared prisoners, Hina Shamsi, director of the ACLU's national security project, said in a statement, calling it "a human rights obligation and a national security necessity."

Former president Barack Obama failed in his bid to close the prison at a US military base in Cuba, which became a symbol of excesses in the "war on terror" launched after the September 11, 2001 attacks.

Demonstrators dressed in Guantanamo Bay prisoner uniforms march past Capitol Hill in Washington, DC, on January 9, 2020
Demonstrators dressed in Guantanamo Bay prisoner uniforms march past Capitol Hill in Washington, DC, on January 9, 2020 AFP / Brendan Smialowski

The Republican Party blocked Obama's plans to shut the prison by 2009 by restricting the ability of the United States to move prisoners from Guantanamo to the US mainland.

Obama's successor Trump mused about sending more suspects to Guantanamo Bay but effectively kept it in place in the same form.

President Joe Biden's White House in February launched a study into how to close the prison but has been careful not to overpromise after the failure of Obama's vow.

A senior official said Monday that the administration "remains dedicated" to transferring prisoners and ultimately closing the facility.

Of the 39 detainees remaining, "10 are eligible for transfer, 17 are eligible for periodic review boards, 10 are involved in the military commission process, and two detainees have been convicted," a second senior Biden official said Monday.

The State Department praised Morocco's role in Nasir's transfer, saying the kingdom's "leadership in facilitating Nasir's repatriation, alongside its past willingness to return its foreign terrorist fighters from northeast Syria, should encourage other nations to repatriate their citizens who have traveled to fight for terrorist organizations abroad."

Tarred by accusations of extra-legal imprisonment, denial of rights and torture, Guantanamo was opened in 2002 for suspects captured around the world on the understanding that they would not be entitled to the constitutional right to due process guaranteed on US soil.

It has held up to 780 "prisoners of war." Many were tortured at secret CIA sites before being transferred to Guantanamo. Only about ten of them have been charged.