Image caption Those accused of running brothels can escape prosecution if they have influential clients

A judge in Pakistan has directed a woman accused of running a brothel to "improve herself" by attending classes at a mosque every day for a month.

Chief Justice Dost Mohammad Khan at Peshawar High Court made mosque attendance part of her bail conditions.

The judge said she must visit the cleric for a month for "rectification through religious teachings".

Analysts say that setting a condition of spiritual reform is extremely rare, possibly unprecedented, in Pakistan.

Peshawar High Court Chief Justice Dost Mohammad Khan issued the order while granting bail to four women accused of running a brothel and an alleged male client.

He said the cleric at the mosque must submit a report on the woman's progress once the month has been completed.

The court also asked the police to ensure the cleric at the mosque provided him with a report once the allotted time had elapsed.

The defendant's lawyers argued that police had concocted a case against her.

They argued that her residence was raided without a proper search warrant and that the police were not able to present any witnesses in court to support their charges.

Chief Justice Khan said that he regretted that there were so few vocational training facilities for jobless women, forcing them to adopt "illegal means" to earn a living.

The BBC's M Ilyas Khan in Islamabad says that the judge may have made his order because there was insufficient evidence - especially a lack of medical evidence - for the judge to send her to prison.

At the same time, our correspondent says, Chief Justice Khan was apparently unwilling to allow her to walk away scot free and took the decision for her in effect to receive religious counselling.

However the cleric assigned the task of overseeing court sentences told the BBC that while he had heard about the order, he had not yet been formally asked to implement it.

Correspondents say that in many cases, those accused of running brothels can escape prosecution if they have influential clients.

But if they are taken to court, they usually get harsh sentences.

The BBC's Haroon Rashid in Islamabad says that it could well be the first time a court has sought the religious reformation of woman accused of prostitution.