A prominent Hong Kong popstar who was charged with corruption for singing at an election rally of a pro-democracy politician agreed to a good behaviour order on Thursday in return for prosecutors dropping their case.

Anthony Wong Yiu-ming, a local Cantopop singer and one of the city's most visible LGBTQ activists, was arrested by the Independent Commission Against Corruption (ICAC) on Monday.

The 59-year-old and former lawmaker Au Nok-hin were charged with engaging in corrupt conduct by providing "entertainment to induce others to vote for the candidate" at a rally Au held on March 3, 2018, in the run-up to local legislature elections.

The arrests came as Hong Kong authorities carry out a widespread crackdown on dissent following huge and often violent pro-democracy protests two years ago.

At a court hearing on Thursday, prosecutors agreed to settle the case against both Wong and Au by imposing a bind-over order.

Used in some common law jurisdictions, a bind-over order covers minor offences and allows prosecutors to drop a case in return for the accused promising to maintain good behaviour for a designated period of time.

Wong and Au were bound over for a period of 18 months and ordered to pay HK$2,000 (US$257).

Outside court, Wong serenaded reporters with an old Cantonese song about honesty
Outside court, Wong serenaded reporters with an old Cantonese song about honesty AFP / ISAAC LAWRENCE

At the hearing, prosecutors said there was no evidence Wong had been paid for his performance or was told by Au to endorse him.

While Wong walked free without a criminal record, Au was returned to prison where he is currently serving a 10-month sentence for taking part in democracy protests.

He is also one of dozens of democracy activists facing life in prison after being charged under a new security law Beijing imposed on Hong Kong to snuff out dissent.

Wong rose to fame in the 1980s and became one of the first local celebrities to publicly reveal his LGBTQ status in 2012.

He is one of a handful of Hong Kong celebrities willing to criticise Beijing and support democracy -- a stance that means he is blacklisted on the Chinese mainland.

Outside court, Wong serenaded reporters with an old Cantonese song about honesty.

"Hong Kongers, hang in there," he said afterwards.