The New Zealand war veteran locked up in a Perth prison without charge is giving up his fight to stay in Australia, and will be deported to New Zealand.
Ko Haapu has been in immigration detention for almost four months without charge after his visa was cancelled because he belonged to an outlawed motorcycle gang, the Rebels.
His lawyer, Michael Pena-Rees, said it was very disappointing but, given Mr Haapu had no prior convictions, he would rather leave than be subjected to prison for a long period of time.
The former soldier was part of the security detail for Prime Minister John Key in Afghanistan in 2010.
A friend of Mr Haapu said the authorities kept pushing back the court dates and had been difficult.
Earlier this month, Mr Haapu wrote an angry open letter to Australian Immigration Minister Peter Dutton, accusing him of a deliberate campaign of harassment against him and his partner.
His lawyer had previously said he was worried being in prison may have been exacerbating any post-traumatic stress disorder Mr Haapu may have been suffering from his time in a war zone.
Watch a Checkpoint With John Campbell interview with Mr Haapu's partner Teresa Mariner in January here: