A former CIA contractor charged with beating an Afghan detainee who later died was released from custody Friday pending his trial on assault charges.

David A. Passaro, 38, had been jailed since his arrest in June. He was charged June 17 with four counts of assault stemming from the beating of Abdul Wali at a U.S. military base in Afghanistan in June 2003. Wali later died.

Passaro, a former Green Beret, walked out of the federal courthouse after a brief hearing at which U.S. District Court Judge Terrence Boyle reviewed the conditions for release, which include an electronic monitoring device. Federal prosecutors had sought unsuccessfully to delay the release until they had a complete set of papers putting Passaro's home up as security.

Outside the courthouse, Passaro hugged friends and said he was grateful that Boyle released him and looked forward to his trial.

"It feels great," he said of his release.

Prosecutors say Wali died after two days of interrogations and beatings by Passaro, who was working as a contractor for the CIA at the base. Prosecutors said three paratroopers from the 82nd Airborne Division would testify that they witnessed the beating.

If convicted, Passaro could be sentenced to up to 40 years in prison and fined $1 million.

Passaro once was a Hartford, Conn., police officer but was fired before his probationary period was over after he beat up another person.