American officials also acknowledged that there are serious health risks to detainees and American military personnel who work at the Bagram prison, because of their exposure to heavy metals from the aircraft-repair machinery and asbestos.

“It’s just not suitable,” another Pentagon official said. “At some point, you have to say, ‘That’s it. This place was not made to keep people there indefinitely.’ ”

That point came about six months ago. It became clear to Pentagon officials that the original plan of releasing some Afghan prisoners outright and transferring other detainees to Afghan custody would not come close to emptying the existing detention center.

Although a special Afghan court has been established to prosecute detainees formerly held at Bagram and Guantánamo, American officials have been hesitant to turn over those prisoners they consider most dangerous. In late February the head of detainee operations in Iraq, Maj. Gen. Douglas M. Stone, traveled to Bagram to assess conditions there.

In Iraq, General Stone has encouraged prison officials to build ties to tribal leaders, families and communities, said a Congressional official who has been briefed on the general’s work. As a result, American officials are giving Iraqi detainees job training and engaging them in religious discussions to help prepare them to re-enter Iraqi society.

About 8,000 detainees have been released in Iraq since last September. Fewer than 1 percent of them have been returned to the prison, said Lt. Cmdr. K. C. Marshall, General Stone’s spokesman.

The new detention center at Bagram will incorporate some of the lessons learned by the United States in Iraq. Classrooms will be built for vocational training and religious discussion, and there will be more space for recreation and family visits, officials said. After years of entreaties by the International Committee of the Red Cross, the United States recently began to allow relatives to speak with prisoners at Bagram through video hookups.