Scarlett Johansson has been praised by actors in the transgender community for listening to criticism and dropping out of an upcoming drama in which she was set to play a trans character.

The 33-year-old was set to take the lead role of Dante "Tex" Gill in a biopic, entitled Rub and Tug, about the massage parlour owner who was a transgender man with ties to organised crime.

Johansson's casting was criticised by some who felt the part should have been given to a transgender actor, but the Avengers star has now stepped down from the project, saying she has "learned a lot" since initially joining the cast.

LGBT media monitoring group GLAAD welcomed Johansson's decision.

"Scarlett Johansson's announcement, together with the transgender voices who spoke out about this film, are game changers for the future of transgender images in Hollywood," said GLAAD's President and CEO, Sarah Kate Ellis.

"Hollywood changed how Americans understand gay and lesbian lives, and TV is starting to do the same for transgender people with authentic transgender portrayals being major hits with critics and audiences. The film industry has a real opportunity to do the same."

Transgender actors also praised Johansson for vacating the role.

In a statement quoted in LGBT lifestyle publication Out, Johansson had said: "In light of recent ethical questions raised surrounding my casting as Dante Tex Gill, I have decided to respectfully withdraw my participation in the project.

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

"I have great admiration and love for the trans community and am grateful that the conversation regarding inclusivity in Hollywood continues."

Johansson added: "While I would have loved the opportunity to bring Dante's story and transition to life, I understand why many feel he 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.

"I believe that all artists should be considered equally and fairly."

Johansson had previously appeared to defend her decision to accept the part by suggesting she was not the first actor outside of the trans community to play a transgender character in a film.

She said in a statement earlier in July that any criticism "can be directed to Jeffrey Tambor, Jared Leto and Felicity Huffman's reps".

Johansson was previously at the centre of a row over perceived whitewashing after she starred in the remake of the Japanese sci-fi anime film Ghost in the Shell in 2017.

Rupert Sanders, who directed the adaptation, is also set to direct Rub and Tug.