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 is gravely concerned about the move because judges have been giving directions on rape myths for decades - and that it sends completely the wrong message to imply they have not.

The judiciary also 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.

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.

Baroness Levitt said she has seen the government's amendment and it would "achieve the overwhelming majority of what many of us have been seeking to achieve".

She also noted the directions given by the judge in the Brand case "appear to have been exemplary" and she believes 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 added the government amendment "fully respects judicial independence" and judges "remain entirely free to decide how best to address these issues in the context of the individual request before them".

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".

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