A LAW to permit judges to address the "unenlightened views" of some jurors in sex crime cases and crack down on "revenge porn" has been passed by the Scottish Parliament.

The Abusive Behaviour and Sexual Harm (Scotland) Bill was passed unanimously by MSPs.

Justice Secretary Michael Matheson noted that the provisions which will allow judges to direct juries about common misconceptions of sex attackers and their victims have been hotly debated, but he stressed that ministers regard them as an important part of the Bill.

"There are some members of the public that make up the jury that decide sexual offences cases that hold preconceived and at times ill-founded beliefs about how sexual offences are committed," he said.

"These unenlightened views concern the way in which someone who has been sexually assaulted or raped will react when the offence is committed and afterwards."

He said some people "quite wrongly assume" that sex attackers will use physical force, and that victims will resist and immediately contact the police, when research shows that the reality "is quite different".

"These statutory jury directions are to ensure that the focus of the jury is on the evidence laid before them, and that any misconceptions that jurors hold about how people react to sexual crime should play no part in how evidence in a case is considered," he said.

The Bill also introduces a "domestic abuse aggravator" to ensure courts take domestic abuse circumstances into account when deciding a sentence, and provisions to prosecute sex offences committed by Scottish residents elsewhere in the UK.

"Victims can be far too shocked or scared about what else could happen to them if they offer any physical resistance," she said.

"Who knows? You could end up being murdered as well as attacked."

The Tories backed the move to outlaw revenge porn, which justice spokeswoman Margaret Mitchell described as a "vexing crime with far reaching consequences".

The new offence of disclosing, or threatening to disclose intimate images without consent "criminalises behaviour which is deeply distressing to victims" and allows Scotland to keep pace with similar legislation in England and Wales, the Conservative said.

But both she and Christine Grahame, the convener of Holyrood's Justice Committee, raised concerns about changes to the directions given to juries when considering rape and some sexual offences.

Ms Mitchell said the move to put these on a statutory footing was the "most controversial provision within the Bill".

The Conservative said courts could use expert witnesses to dispel misconceptions over issues such as why there might have been a delay in reporting the offence.

She argued: "The same outcome could be achieved without the adverse constitutional implications of statutory jury directions."

Grave concerns about the move have been expressed by the Law Society of Scotland, the Faculty of Advocates and others, Ms Mitchell said.

"This is because provisions for statutory jury direction compromise the independence of the judiciary, which is a central tenet of Scots law," she argued.

"They blur the constitutional divide between legislators and the judiciary, they strike at the separation of powers and they raise constitutional issues which compromise democracy in Scotland."

She concluded: "This is a dark day for our democracy in Scotland."

Ms Grahame said: "The Bill proposes that for the first time we set out in statute what directions judges must give to juries in certain cases.

"If evidence is led about an apparent delay in reporting or telling anyone about an alleged sexual assault , the judge must direct the jury there may be good reasons for the delay."

She added: "This is parliament, in my view, interfering too deeply in the courts' discretion."