The U.S. military plans to vacate Abu Ghraib prison by August, handing over operation of the facility to Iraqi security forces and transferring the remaining detainees 300 miles to the southeast, prison authorities said Wednesday.

In an interview at the prison, Maj. Gen. Geoffrey D. Miller, deputy commander of U.S. military detainee operations in Iraq, said the military had already relinquished the cell blocks at Abu Ghraib, where American soldiers were photographed abusing Iraqi prisoners late last year. The last of the security detainees -- civilians accused of attacks on U.S. forces -- being held by the U.S. military were moved last week from the cell blocks to tent camps on the grounds of the 280-acre Abu Ghraib compound, 20 miles west of Baghdad.

About 1,500 prisoners accused of common crimes remain in the cell blocks, guarded by Iraqi police.

The 3,000 security detainees will remain in tents here until they are released or transferred to Umm Qasr, the port in southern Iraq where 2,000 detainees are already being held at a facility called Camp Bucca. Miller said the prisoners will be safer at Camp Bucca than at Abu Ghraib, where a mortar attack in April killed 22 detainees and wounded 91.

The plans outlined by Miller made clear that the United States will maintain a large detention facility in Iraq after June 30 to deal with what it deems to be security threats. It was not clear, however, what authority the U.S. military will have to detain and operate a facility in Iraq when it is no longer the occupying power in the country.

Miller said 980 prisoners will be released from Abu Ghraib in the next two weeks as military officials attempt to reduce the prison population to 1,500 by June 30, when occupation authorities are to turn over limited authority to an interim Iraqi government. More than 1,700 prisoners have been released in the last 30 days.

Seven members of the U.S. Army's 372nd Military Police Company have been charged with abusing detainees at the prison. In statements to investigators, the soldiers said they were ordered to prepare prisoners for interrogations by military intelligence officers.

An Army investigation released in March found that Miller, who was brought here last fall to advise on improving interrogations of Iraqi detainees, had encouraged military police officers to play a greater role in interrogations. Miller has denied the assertion.

The top U.S. intelligence officer at Abu Ghraib also has said in sworn testimony that Miller inspired and promoted the use of guard dogs there to frighten the Iraqis. Miller has denied telling the officer, Col. Thomas Pappas, to use the dogs.

In an interview at Abu Ghraib on Monday, Lt. Col. Craig Essick, commander of the 391st Military Police Battalion, which has 700 soldiers at the prison, said his military police escort prisoners to interrogation and bring them back but do not "get involved directly with interrogations."

"We aren't doing anything except what we should be doing," he said.

As he toured the prison with a group of mostly Iraqi journalists on Wednesday, Miller walked past shiny chain-link fences topped with barbed wire. Behind the barriers, detainees wearing civilian clothes or towels draped around their waists signaled with their hands and called out in Arabic.

Miller said life in the prison has improved significantly in the past month. "Thirty days ago, they weren't waving," said Miller, the former commander of the U.S. military prison at Guantanamo Bay, Cuba. "We're working very hard. It's hard to be patient."

As Miller approached the fence, three English-speaking detainees spoke softly to him. They were the mayors of the section of the camp that was known as Camp Avalanche but was renamed Camp Redemption this month at the suggestion of a visiting member of the Iraqi Governing Council. The mayors represent different factions among the detainees.

"They always want to know the same thing: When am I getting out?" Miller said when asked what the detainees had discussed with him.

Miller said the military has made significant progress in winning back the trust of the detainees. He said violence among prisoners has dropped and the mood of the camps improved since detainees started being released.

A new visitor's center has been erected during the last several weeks, allowing up to 256 visits a day. Family visits had been limited to 30 per day. When families visit, the soldiers take a photograph of the detainee with his family. One copy is given to the family, and one is left with the detainee. "Being detained is hard enough," Miller said.

Convincing the rest of the Iraqi population that the military is treating the detainees humanely "will take more time," he said. "These detainees will have to tell the story."

Iraqis have complained that the U.S. military is unlawfully detaining people at the prison. Brig. Gen. Mark Kimmitt, the military's top spokesman in Iraq, said Monday that the military is in the process of reviewing all prisoner files.

"We don't put them in Abu Ghraib to detain them for a period of time or to detain them until proven innocent," Kimmit said. "They are deemed to be a security threat by a judge through multiple sources. It's that simple. If they were innocent, they wouldn't be at Abu Ghraib."

Special correspondent Bassam Sabti contributed to this report.

Inmates of the Abu Ghraib prison on the outskirts of Baghdad listened to a sermon during evening prayers on May 7. The last of security detainees being held by the U.S. military were moved from cells to tent camps last week. About 1,500 prisoners accused of common crimes remain in the cell blocks, guarded by Iraqi police.