WASHINGTON — The United States transferred four detainees from the Guantánamo Bay prison to Afghanistan late Friday, the Defense Department announced Saturday, fulfilling a request from the new Afghan president, Ashraf Ghani, in what officials here characterized as a show of good will between the United States and the government in Kabul.

The four men are not likely to be subjected to further detainment in Afghanistan, an Obama administration official said. The transfer brings the number of Afghans still held at the American military prison in Cuba to eight of the 132 detainees over all.

The transfer is the latest in a series of detainee releases and reflects a quickened pace, as President Obama has been pushing to make good on his goal of shutting the military prison at Guantánamo, a pledge that dates to the earliest days of his presidency. One administration official said more transfers are expected in the coming weeks.

Delays by Secretary of Defense Chuck Hagel in signing off on transfers that had been approved by Mr. Obama’s national security staff contributed to tensions between the exiting Pentagon chief and the White House, particularly with the national security adviser, Susan Rice. But Mr. Hagel, who resigned under pressure last month, has maintained all year that he would not be rushed into releasing prisoners.