Judges are set to be legally required to dispel rape myths when directing juries in sex offence trials.

The government said it will amend a bill in Parliament to make it compulsory, after a barrister was accused of using rape myths during the trial of Russell Brand.

It added the law change would send a clear signal that false and harmful assumptions about how victims should act should not be used against them.

The Criminal Bar Association said it was concerned by the move, arguing the announcement "does victims no favours" because it wrongly suggests that judges are not already challenging rape myths in court.

Its chair, Andrew Thomas KC, said the change risked undermining "the professional integrity of trial judges" and argued victims and defendants would be better served by courts focusing on trying cases "efficiently and fairly" rather than making announcements which "do not in fact change anything".

The comments come after the judiciary recently strengthened its guidance on rape myths following Brand's trial.

The disgraced entertainer was sentenced to 10 years and six months in prison at the start of November after being convicted of rape and sexual assault.

Defence barrister, Ian Winter KC, during his closing speech at the end of the trial, questioned why Brand's accusers had not fought back.

Winter also asked the jury if they could be sure that out of the "many, many women" Brand had had sex with over a decade, "he raped just three of them".

This led to fierce criticism from women's campaigners, the commissioner of the Metropolitan police and the government.

Addressing Brand during sentencing, Mr Justice Bennathan said women have the right to withhold consent regardless of the circumstances.

"Whatever women wear, wherever they go, indeed whatever they drink, they retain the right to say no," he said.

The judge added that women also have the right "to demand justice from the criminal courts when sexual predators like you, Russell Brand, act without their consent".

After the government announced in the House of Lords its plan to make changes, Prime Minister Andy Burnham said: "I never want a victim of rape or sexual assault to walk into a courtroom and feel like they're the one on trial.

"I know the balance hasn't always felt like it is on the side of victims, and I am determined to put that right."

'You lured him in': Rape myths and what we still get wrong about sexual assault

Russell Brand prison message 'appalling' and being investigated, No 10 says

The Russell Brand I saw in court was not the flamboyant character most people will know

Justice Minister Lord Lemos told peers the government would bring forward an amendment to the Courts and Tribunals Bill.

He said this would state judges "must give directions to the jury on rape myths and misconceptions in all sexual offences cases, unless they're convinced that it is unnecessary, and this will of course include sexual offences committed in the domestic abuse context".

The government's proposal came in response to calls from peers, led by Labour former Justice Minister Baroness Levitt KC, to make it mandatory for judges to warn juries about rape myths.

Speaking on BBC Radio 4's Today programme, Baroness Levitt said the change was not intended as a criticism of judges, but was aimed at ensuring protections were applied consistently across cases, so that "best practice becomes universal practice".

She said the measures would help juries "focus on the evidence in front of them" rather than assumptions about how a rape victim should react.

Levitt has also previously said the directions given by the judge in the Brand case "appear to have been exemplary" and that the "overwhelming majority of judges already deal with these issues with great care and skill".

Baroness Levitt told the Lords: "The concern was a different one: there remains a perception, rightly or wrongly, that in a small number of cases these protections are not always applied as consistently as they should be and that perception matters."

She also said the government's amendment "fully respects judicial independence" and that judges would remain "entirely free" to decide how best to address the issues in individual cases.

The victims' commissioner for England and Wales, Claire Waxman, welcomed the move as a "significant win" for those who had campaigned for change.

She said rape myths can have a "devastating impact" on victims and survivors, and described the new directions as "a vital step" towards challenging those myths in courtrooms and ensuring people are "treated fairly, with dignity and respect."

Baroness Fox of Buckley, a non-affiliated peer, said it is "very important" the focus is on victims and survivors, before saying her "worry is the possibility that fair trials in rape cases could be compromised in some way by over-intervention".

Baroness Fox, in one of her questions about possible changes, said: "Could attempts to eliminate one form of jury bias inadvertently introduce another, tipping the evidential balance against the defendant?"

Crossbench peer Lord Pannick KC said he hopes the government amendment will leave it to the judiciary to "decide what specific directions are needed".

Conservative shadow attorney general Lord Wolfson of Tredegar KC said the Opposition will look at the government's amendment "very carefully", adding Lord Pannick's point has "real force".

In his contribution, Lord Pannick referred to updated guidance in which judges were told directions to juries on rape myths "should always be given".

The Crown Court Compendium, which provides judges with guidance on directing juries in Crown Court trials, was updated on 24 November to add that alerting a jury to the "potential error" of this kind of thinking "remain important and necessary."

The messaging appears in the official handbook published by the Judicial College, which guides judges and recorders in England and Wales.

The compendium's section on sexual offences trials previously told judges they "may give appropriate directions to counter the risk of stereotypes and assumptions about sexual behaviour and reactions to non-consensual sexual conduct".

Have you been affected by the issues raised in this story? If you feel able to do so, please get in touch.

Sign up for our Politics Essential newsletter to keep up with the inner workings of Westminster and beyond.