A Malaysian man was baffled to find out that wearing shorts on the way to play sports would earn him a fine and a reprimand from local religious authorities.

Wan Khairul Hayyee Wali was on his way to play futsal, a five-against-five indoor soccer game, when he stopped by the road to buy his wife a burger Monday night. He was spotted by a Kelantan islamic religious department (JAIK) officer, who told him he was indecently dressed.

“It came as a shock to me when a religious department enforcement officer gave me a notice saying I have flouted the Syariah Criminal Enactment for exposing my knees," the man said, quoted in local media. "Seriously, they can't expect me to wear a sarong to play futsal," he added.

The 30-year-old man, employed as a general worker at a wholesale store, was ordered to attend a counseling session or pay a fine equivalent to $240 should he fail to attend it.

A local religious official told AFP the man was one of 11 people who were reprimanded for “indecent dressing”—among these, four women who were told their outfits were too tight.

The religious authorities said the dress code restrictions apply only to Muslim people appearing in public spaces, but Khairul’s case has stirred controversy in the Pan-Malaysian Islamic Party-ruled state of Kelantan.

In multi-ethnic Malaysia, ethnic Malay Muslims make up a majority of the population that also comprises ethnic Chinese and Indian minorities. The rise of hardline Islamist parties attempting to implement sharia law in recent years has been a cause of tension and concern among minorities.

A local representative of the opposition party Malaysian Chinese Association, Kelantan State Liaison Committee Secretary Dato’ Lua Choon Hann, criticized the imposition of strict dress codes and said it may deter citizens's participation in sports.

“Myself as the President of the Malaysia Basketball Association (MABA), I now have to think twice as to whether to host any basketball matches in my native state, be it in an indoor court or outdoor stadium as I shudder at the thought of JAIK personnel raiding the games, waving summons to be slapped against our cagers or spectators in short pants for ‘indecent dressing,’” he said in a statement.

It isn’t the first time that dress code restrictions have made headlines in Malaysia. Earlier this year, a 12-year-old girl was banned from taking part in a chess tournament in Putraya south of Kuala Lumpur because the tournament’s chief arbiter considered her knee-length dress indecent.

In June 2015, blogger and businessman Wilson Ng claimed that an officer at the Kuala Lumpur International Airport (KLIA) forced him to wear long trousers after being told that his knee-length shorts contravened its dress code.