Jakarta (AFP) - An Indonesian city thought it was doing half a million citizens a good turn by making wireless internet free in government offices.

But red-faced officials in Solo -- where President Joko Widodo was once mayor -- have now cut back on access after it found some were using it to deal drugs, watch illegal pornography or engage in online prostitution.

WiFi access has been switched off from 6:00 pm through 4:00 am, in the hopes it will keep nefarious net users from tapping into the service at night.

The reduced hours are also reportedly aimed at dealing with parent complaints that kids were milling around district offices late into the evening to use the free internet.

This drop in service has been happening over several months but it was first made public this week.

"Free WiFi can be misused for online prostitution," said Taufan Redina, an official in the information and communication department for Solo, which is on Indonesia's main island Java.

"That's what we have encountered so far," he told AFP, adding that "narcotics transactions" and other questionable dealings have been spotted.

It was not clear how the local government knew what some users were doing with their free WiFi access.

Pornography is illegal in Indonesia, the world's biggest Muslim-majority country, although its filter on the internet has not managed to block all adult sites.

Prostitution is also against the law and there are stiff penalties for drugs, including the death penalty for trafficking.