The U.S. Defense Department said Saturday that four Afghans held for more than a decade at the U.S. military prison in Guantanamo Bay, Cuba, had been returned to their home country.

Officials said the four detainees — identified as Shawali Khan, Khi Ali Gul, Abdul Ghani and Mohammed Zahir — were released at the request of Afghanistan's President Ashraf Ghani, after a review of their cases, including security factors.

They said the release was a sign of confidence in Ghani, who has been in office for only a few months.

Most U.S. troops are due to leave Afghanistan by the end of the year.

The U.S. has released 23 prisoners from Guantanamo this year, including six men sent to Uruguay this month to be resettled as refugees. The six had been detained as suspected militants with ties to al-Qaida but were never charged.

Guantanamo's prison population — which stood at 242 when President Barack Obama took office in 2009 — has gradually declined to its current total of 132.

U.S. State Department spokeswoman Marie Harf said 64 of those remaining detainees had been approved for transfer. She also said the U.S. was grateful to the Afghan government for helping to reintegrate the former detainees as another step toward Obama's goal of closing Guantanamo.

Many of the remaining detainees who have been cleared for release or transfer cannot go to their homelands for fear of persecution, lack of security or some other reason.

More than half of the remaining inmates are from Yemen. But the United States does not want them to return there because of the country's chaotic security situation.

The prison opened in January 2002, four months after the al-Qaida terrorist attacks that killed nearly 3,000 people in the United States. Human rights advocates have condemned the U.S. for holding prisoners without trial and for using harsh interrogation techniques at the prison.

Obama took office nearly six years ago promising to shut the prison, citing its damage to America's image around the world. But he has been unable to do so, partly because of obstacles imposed by Congress.

The United States has also found it difficult to find countries willing to accept the prisoners.