A legal defence for children who claim they are being exploited by county lines drug gangs needs to be monitored more closely, the Magistrates’ Association has warned.

Judicial concern about the way section 45 of the Modern Slavery Act operates has emerged as gang violence escalates and the government focuses on the disproportionate outcomes for ethnic minority defendants in the criminal justice system.

There are fears among law-enforcement personnel that some youths adopt the defence as a loophole to escape prosecution while others are scared of seeking legitimate protection for fear they may be targeted as “grasses” or informants by other gang members.

“The Magistrates Association is concerned that the growth of county lines activity is leading to exploited children and young people appearing before the courts as defendants for a range of serious gang-related offences,” said John Bache, the organisation’s chair.

“Youth magistrates are seeing an increased risk of children and young people being exploited into gang and drug crime.”

The association, which represents the 15,000 justices of the peace in England and Wales, published a report last month on “disproportionality in the youth justice system”.

It said: “An area of particular concern ... was that not enough was being done to investigate ... whether an individual had been groomed, exploited or drawn into criminal activities. Some who have been criminally exploited are reluctant to use the tools available to help their case (such as the section 45 statutory defence) for fear of being labelled a grass.”

The association said its members’ “anecdotal experience” was that some never see the defence being used while others question whether it is being used more frequently, raising “concerns over its appropriate use”.

An independent review of the Modern Slavery Act, commissioned by the Home Office and published earlier this year, said law enforcement participants had concerns “the defence is being used as a ‘loophole’ for offenders identifying as victims”.

It added it was important to “ensure an appropriate balance between the need to protect victims from criminal prosecution and preventing criminals from abusing this protection to avoid justice”.

Section 45 provides a statutory defence for victims of modern slavery, for certain criminal offences which they were compelled to carry out as a result of their exploitation, such as being forced to sell illegal drugs. It was designed to encourage victims of slavery to give evidence without fear of being convicted for offences connected to their slavery.

The Magistrates Association is critical of the government’s failure to collect data on how often section 45 defences are being used and delays in the national referral mechanism (NRM) which is supposed to identify victims of modern slavery.

The mechanism runs in parallel to court proceedings and is supposed to produce a decision within a 45-day turnaround period. In some cases referrals are being made after charging decisions.

“It is crucial that courts are kept informed of how the NRM is intended to operate and how long the process is likely to take,” the Magistrates Association said.

“Given that vulnerable children and young people will often depend on the section 45 defence when they appear in a youth court, we would welcome more guidance and training for magistrates on its appropriate use.”

A government spokeswoman said: “The exploitation of children for criminal purposes is abhorrent and it is right that those responsible are prosecuted.

“The independent review into the Modern Slavery Act found that the statutory defence strikes the correct balance between protecting genuine victims and preventing misuse from opportunistic criminals.”

• This article was amended on 14 October 2019. The headline and subheading were changed to better reflect and clarify the concerns of magistrates.