KUALA LUMPUR, Malaysia (AP) _ A speech writer for former Deputy Prime Minister Anwar Ibrahim says he lied about having sex with his boss after police beat him, humiliated him and threatened to harm his family.

According to a 55-page affidavit obtained by The Associated Press, Munawar Ahmad Anees, 50, said that while in custody he was deprived of food and medicine and led to believe that his wife and two children would be harmed if he didn't admit to having sex with Anwar.

In the document filed Nov. 7 in Sessions Court, Munawar recounted how police forced him to simulate homosexual acts with Anwar.

``They were bullies and I was in their hands. As I acted out the demeaning, humiliating parts they gave me, they laughed,'' Munawar wrote, describing repeated police interrogations after his arrest on Sept. 14.

Munawar, along with Anwar's adopted brother Sukma Dermawan, 37, were sentenced to six months in jail after pleading guilty Sept. 19 to allowing themselves to be sodomized by Anwar.

A day later, police arrested Anwar, who is facing trial on five counts of corruption and five counts of sexual misconduct, two involving Sukma and Munawar. Anwar says he is innocent, and his lawyers have argued he is the victim of a political conspiracy and trumped-up charges.

Munawar has since retracted his guilty plea and is appealing his conviction. His appeal is scheduled to be heard Dec. 8.

Police said Friday they could not comment on Munawar's allegations because the case was still in the courts.

``The doctor says he suffered psychological trauma and shock after what the police did to him,'' Munawar's wife, Fatima Belhadi, 40, told The Associated Press.

Munawar is being treated at the National Heart Institute after suffering a heart attack while in custody, his wife said. ``Sometimes he falls into deep depression. He still can't sleep at night,'' she said.

In the court documents, Munawar accused police of invading his house Sept. 14 without a search warrant, then arresting him without informing him of his offense. He said police handcuffed him, ransacked his house and confiscated computer disks, tax returns and family photographs.

An officer later told him he had been arrested under the Internal Security Act, which allows indefinite detention without trial.

``He just told me that I was a threat to Malaysia,'' Munawar said in the affidavit. ``I could not understand this at all as I have never in all my years in Malaysia involved myself in anything that could be described as a threat to the country.''

After he was brought to the federal police headquarters, Munawar said the police forced him to strip naked and they shaved him bald. His guards told him that from now on, his name would be ``Number 26.''

``One of the two swung me around and punched me in the stomach,''' Munawar said in the affidavit.

A Pakistani by birth, Munawar also has an American work permit, known as a green card, and is a permanent resident of Malaysia. According to his wife, he lectured in Islamic sciences at the University of Chicago for four years during the 1980s.

Munawar said police threatened to work with ``U.S. agents'' to revoke his green card and ruin his plans to apply for U.S. citizenship.

If he confessed, the police promised him freedom, Malaysian citizenship, a pick of jobs and safety for his family.

``They told me that I had to understand their difficulties because Anwar's people were now my enemies and that they would try to burn my house down and to hurt me and my family,'' he said.

Meanwhile, Anwar's hearing on an appeal to free him on bail was adjourned today until Dec. 5 to allow his defense lawyers more time to prepare their case.