An American expat in Thailand will avoid legal action and a potential prison sentence for posting a negative TripAdvisor hotel review after he reached a settlement with the resort suing him.

Wesley Barnes wrote of encountering "unfriendly staff" who "act like they don't want anyone here" after a stay at the Sea View on Koh Chang island, famed for its sandy beaches and turquoise waters, in June.

In another review that was taken down by the site for violating its guidelines, he accused the hotel of "modern day slavery".

The resort later sued Mr Barnes and he spent two days in custody after being arrested and charged under Thailand's strict defamation laws.

The maximum sentence is two years in prison, along with a 200,000 baht (€5,460) fine.

Mr Barnes and the resort reached an agreement after a mediation session overseen by police, Colonel Kitti Maleehuan, Koh Chang police station superintendant said.

Mr Barnes had "agreed to comply with proposals from the hotel," Col Maleehuan said, including apologising to the hotel and its staff.

The American, who works in Thailand, must also apologise to the kingdom's Tourism Authority and provide an explanation to the US embassy.

If he complies with the settlement terms, the hotel said it would withdraw the complaint.

Domestic tourism is still happening in Thailand, where coronavirus numbers are relatively low with 3,622 cases and only 59 deaths.

Many locals and expats are making the most of the tourism slump to enjoy near-empty resorts.

Thailand's anti-defamation laws have long drawn scrutiny from human rights and press freedom groups, who say powerful players use it as a weapon to stifle free expression.

Earlier this year, a Thai journalist was sentenced to two years in prison for posting a tweet referencing a dispute over working conditions at a chicken farm owned by the Thammakaset company.