Israel kidnapped Dirani in 1994 as a bargaining chip in exchange for information on Ron Arad, whose plane was shot down over Lebanon in 1986. Dirani is to be released in a large-scale prisoner swap this week.
On Tuesday, he told a Tel Aviv court that the Shin Bet security services kept him naked in an interrogation facility for a month as they questioned him around the clock.
The interrogators alternately splashed him with hot and freezing water, shook him until he fainted, squeezed his testicles, sodomised him and sexually assaulted him with a stick, he said.
"I would pray that I'd die," said Dirani.
Dirani described how one captor named George brought a uniformed soldier nicknamed Kojak into the room. The soldier dropped his pants and George told Dirani the soldier would sodomise him if he did not talk, he said.
"I couldn't see or resist ... I was raped by the soldier. He said he would rape me, and he did"
Hizb Allah detainee
Days later, Dirani was shackled and pushed down onto a bench, he said. "I couldn't see or resist ... I was raped by the soldier. He said he would rape me, and he did," he told the court.
In the courtroom, Dirani identified George from a photograph he was shown. Tuesday's comments were his first since being kidnapped.
Israeli and international human rights groups say Israel has routinely tortured Arab detainees during interrogation by depriving them of sleep, tying them up in painful positions and forcing them to wear hoods on their heads.
In 1999, Israel's Supreme Court banned the blanket use of such practices, and said they could only be authorised in specific instances.
Dirani, 53, testified as part of his lawsuit seeking 6 million shekels ($1.3 million) in damages for the alleged abuse, which he said took place years before the Supreme Court ruling. He limped badly and walked with a cane when he entered the Tel Aviv court room. He spoke only reluctantly and had to be coaxed into giving details about the torture.
In Dirani's hometown villagers are
preparing for his return
Dirani is scheduled to be released on Thursday as part of a prisoner exchange between Israel and the Lebanese resistance group Hizb Allah.
Israel will release Palestinian, Lebanese and other Arab prisoners in exchange for Israeli Elhanan Tannenbaum and three Israeli soldiers, widely presumed dead.
Hizb Allah says Tannenbaum is a spy, while Israel insists he is a businessman.
Israel accuses Dirani of involvement in the capture of Arad and holding the airman captive at one point.
But on Tuesday Dirani said Arad had spent only one night in his southern Lebanon house after his capture and he had nothing to do with his subsequent fate.
"I treated him well," he said. "I hope that (Arad) will soon be able to go home to his family safe and sound."
Dirani's planned release is causing an uproar in Israel with Arad's former comrade's accusing Israel of abandoning its most sacred tenets-never leave a soldier behind on the field of battle.
It was unclear how Dirani intended to proceed with his case after his planned release via Germany.
The Tel Aviv District Court was also due to hear testimony from other witnesses as well as medical reports in the case.