WASHINGTON — The military announced Thursday that it had repatriated an Algerian detainee who had been held without trial for 12 years at the prison at Guantánamo Bay, Cuba. The transfer is the first in nearly three months, and it reduces the inmate population there to 154.

The detainee, Ahmed Bin Saleh Bel Bacha, 44, was the final Algerian prisoner whom a task force recommended for transfer more than four years ago. Four others were sent back last year, two in August and two in December. The task force, with members from six national security agencies, reviewed the case of each prisoner at Guantánamo during the Obama administration’s first year.

“We greatly appreciate the close cooperation of the government of Algeria in receiving one of its nationals from Guantánamo,” Cliff Sloan, the State Department’s special envoy for the prison’s closing, said in a statement. “Today’s transfer represents another step in our ongoing efforts to close the detention facility at Guantánamo.”

A leaked threat assessment file for Mr. Bel Bacha completed in 2005 says he was a veteran of the Algerian Army who later attended the Finsbury Park mosque in London, then known as a center of radical Islamism.