Former Guantanamo Bay detainee Mamdouh Habib has agreed to drop his lawsuit against the Federal Government for being complicit in his torture while he was detained.

The Federal Government has paid an undisclosed amount to Mr Habib to absolve it of legal liability in the case.

Mr Habib was detained by the United States as a suspected terrorist for three-and-a-half years in the fallout from the September 11 terrorist attacks.

He says he was drugged, sexually assaulted and beaten at Guantanamo. He alleges the Australian Government was aware of his harsh treatment and therefore was indirectly responsible.

A spokesman for Attorney-General Robert McClelland says Mr Habib reached a negotiation settlement with the Government last month.

"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," the spokesman said.

The amount of money paid out has not been revealed but one of the terms of settlement involves absolving the Government of legal liability.

The settlement brings an end to a six-year-long compensation case.

The settlement comes after Mr Habib was cleared by the Federal Court to sue the Government for aiding and abetting his torture by agents in Pakistan, Egypt, Afghanistan and Guantanamo Bay.