The Australian government is to pay damages to an Indian doctor who was wrongly charged over a failed bomb plot in the UK in 2007.
Mohamed Haneef, who had been working in Queensland, was held for several weeks on terrorism-related charges over a foiled attack on London and Glasgow.
He had his working visa cancelled and was later deported from Australia.
An Australian judicial inquiry in 2008 cleared him of any wrongdoing and concluded that mistakes had been made.
Mr Haneef was charged with supporting a terrorist organisation when his mobile phone SIM card was linked to the 2007 attack.
Australia's Attorney-General Robert McClelland said he hoped the confidential payout would bring Mr Haneef and his family closure.
Mr McClelland said the inquiry into Mr Haneef's detention had clearly identified shortcomings in the way he was dealt with when the John Howard government was in power.
He said the government would adopt the recommendations made in the Haneef case to avoid a similar situation happening again.
Mr Haneef's lawyer, Rod Hodgson, described the compensation as "substantial".
"Today's momentous outcome has been a long time coming for Dr Haneef," he said.
"The mediation closes the book on an incident that was a stain on Australia's reputation as a fair place to work and live."
Mr Haneef is currently working as a doctor in the United Arab Emirates.
Last week, he told a press conference that a litany of errors by the Australian police and the government had stained his reputation and career prospects.
"My wrongful arrest and detention in 2007 was a traumatic experience for me and my family. It has impacted on all areas of my life...
"I hope that by resolving my matter it will help repair the damage."
Mr Haneef's legal team had sought damages for his treatment - including malicious prosecution, false imprisonment and defamation.