Fed up with people breaking virus quarantine rules, one Indonesian politician has decided to scare rulebreakers straight by locking them in a "haunted house".

Sragen regency head Kusdinar Untung Yuni Sukowati says she issued the unusual edict this week to deal with an influx of people to the area after lockdowns in the capital Jakarta and other major cities.

Some newcomers, however, weren't respecting orders that they isolate themselves for 14 days to prevent the spread of coronavirus across the region on Indonesia's densely populated Java island.

So Sukowati instructed communities to repurpose abandoned houses that were feared to be haunted -- tapping widespread beliefs in the supernatural, which play a key role in Indonesian folklore.

Five people have been tossed into Sragen's spooky jails so far.

"If there's an empty and haunted house in the village, put people in there and lock them up," Sukowati told AFP Tuesday when asked about the rule.

Officials in Sepat village chose a long-abandoned house and outfitted it with beds placed at a distance and separated by curtains.

So far, the village has locked up three recently-arrived residents who are being forced to spend the remainder of their two-week quarantine in the spooky abode.

Among them was Heri Susanto, who said his punishment hadn't brought him face to face with any ghosts -- so far.

"But whatever happens, happens," said Susanto, who came from neighboring Sumatra island.

"I know this is for everyone's safety. Lesson learned."