American actress Scarlett Johansson has quit her role in the upcoming film Rub & Tug following backlash to her playing a transgender character.

The 33-year-old was set to star in the film, playing US crime kingpin Dante “Tex” Gill – a transgender man who used his massage parlour as a front for prostitution in the 1970s and 1980s.

She said she decided to stand down from the role after realising it was “insensitive” to take it on.

“Our cultural understanding of transgender people continues to advance, and I’ve learned a lot from the community since making my first statement about my casting and realise it was insensitive,” Johansson told the LGBT magazine Out.

“I understand why many feel he [Gill] should be portrayed by a transgender person, and I am thankful that this casting debate, albeit controversial, has sparked a larger conversation about diversity and representation in film.”

The casting drew criticism on social media, with many in the LGBT community hitting out at the limited opportunities for transgender actors.

According to advocacy group GLAAD, out of the 109 films released by Hollywood’s seven biggest studios in 2017, none included a transgender character.

In recent years, several transgender characters have been played by non-transgender actors. They include Eddie Redmayne’s role in The Danish Girl, Jared Leto’s role in Dallas Buyers Club, and Jeffrey Tambor’s portrayal in the television series Transparent.

More from Scarlett Johansson

The controversy surrounding Johansson’s part comes after she faced criticism for appearing in 2017’s Ghost In The Shell and playing a character originally conceived as Japanese.

The filming for Rub & Tug is yet to start and no replacement has yet been announced.