Nine Australian men who stripped down to swimwear emblazoned with the Malaysian flag have been freed after spending four days in detention.

The men, aged between 25 and 29, pleaded guilty to public nuisance charges. They were were cautioned and discharged on Thursday at court near the formula one race track where they were arrested on Sunday.

Judge Harith Sham did not convict or fine the men, who were allowed to leave Malaysia immediately. The maximum fine for a public nuisance crime is 400 Malaysian Ringgit, about £76 or $127 AUD.

He said that regardless of their intention, the men had disrespected Malaysia by unveiling the country’s national flag on their swimwear at the grand prix, according to the Australian Associated Press.

The Malaysian flag is a strong symbol of sovereignty and monarchy and the stunt angered many across the south-east Asian nation.

The judge added that he hoped their ordeal would remind the boys, who all dressed in suits for their court appearance, and others about respecting the culture and customs of Malaysia.

The lawyer representing the men, Shafee Abdullah, said they had spent four nights in a “not very friendly lock-up”.

One detainee, Thomas Whitworth, fainted during the court session and was given water and had his handcuffs removed. He collapsed after reading an letter of apology to the court that described the men’s “folly”.

Another member of the group, Jack Walker, is an adviser to the Australian government minister Christopher Pyne.

John Walker, Jack’s father, was at court and said it was an excellent result.

“There was no charge, there was no fine. The boys apologised. They recognised what they did was unacceptable but they have been completely cleared and are free to travel and go home and resume their lives,” he told reporters after the hearing.



He said their experience being locked up since Sunday was “horrendous”.



A spokeswoman for Pyne said the matter was being “handled appropriately by the Australian high commissioner”.

Large media pack swarm the 9 Australians as the arrive at Serpang court #Malaysia pic.twitter.com/20vVkjUJ0A — Samantha Hawley (@samanthahawley) October 6, 2016

The Australians wore matching tightly fitted swimwear at the Malaysian grand prix on Sunday, a planned celebratory stunt that ended in detention.

The men, who have become known in Australian media as “the budgie nine”, were enjoying the formula one win of Australian Daniel Ricciardo, also poured beer into their shoes and drank it, while being filmed by those around them.

The head of research and development for Budgy Smuggler, the company that makes the bespoke swimwear the nine men wore, told the Guardian there had been an increase in sales around the world since the incident on Sunday.

Jarrod Allen said the company was unable to meet the demand for custom made flag swimwear.

“We probably owe the boys a few schooeys [schooners of beer]. After this cultural enlightenment, we’ll wait until they’re home though. Lesson learned,” he said.

“We’ve even had over a dozen orders from Malaysia although given the political sensitivity we are going to let them go through to the keeper and will not produce again. We’d never set out to intentionally disrespect,” he added.

A Muslim-majority nation, with many people holding conservative values, Malaysia is also one of south-east Asia’s most accessible business and tourist destinations. But some visitors are unaware of local sensitivities.