Sydney:  A former inmate at the US military prison at Guantanamo Bay has dropped a lawsuit against the Australian government after accusing it of complicity in torture he said he suffered while in detention.

Mamdouh Habib reached an out-of-court settlement with the government for an undisclosed sum, both parties said on Saturday.

Habib, an Australian citizen, was arrested in Pakistan in late 2001 and held for three years without charge before being returned to Australia in 2005.

An Egyptian-born Muslim immigrant, he was detained in Pakistan for 28 days after his arrest and interrogated by Americans. He was transferred to Egypt, then six months later to the US military base at Bagram, Afghanistan, and then to the US prison for terrorism suspects at Guantanamo Bay, Cuba.

Habib alleged he was beaten and given electric shocks by his captors while he was in Pakistan and Egypt, kept drugged and shackled, had his fingers broken, and was sexually molested. He said Australian officials were present during parts of his ordeal.

He sued the Australian government for what he said was its failure to uphold his rights as a citizen during his detention.

The case was withdrawn after the settlement was reached in mid-December absolving the Australian government of any responsibility for the alleged mistreatment. Other details were not released.

"In reaching this settlement, the government acted in the best interests of the commonwealth to avoid further protracted litigation and to enable our agencies to focus on their core responsibilities of protecting our national security," Attorney-General Robert McClelland's office said in a statement.

Prime Minister Julia Gillard said the details of the settlement were confidential.

At a news conference on Saturday, she dodged a reporter's question about whether the settlement included an apology.

"Clearly, this is a matter that has been a long time in the making and ... it wasn't in our interests to have a long and protracted litigation," Gillard said.

"It was in the interests of taxpayers to bring this matter to an end."