Image copyright Reuters Image caption The star said she realised it would be "insensitive" to take up the role

US actor Scarlett Johansson has dropped out of a role in which she was going to play a transgender man following a backlash from the LGBT community.

The Avengers star was set to play 1970s Pittsburgh crime boss Dante "Tex" Gill, who was born Jean Gill, in Rub & Tug.

But she was criticised by those who said the role should have gone to a transgender actor.

"I've learned a lot from the community since making my first statement," Johansson told Out magazine.

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

"I am thankful that this casting debate... has sparked a larger conversation about diversity and representation in film," she added.

The original announcement was met with intense criticism and some said it showed the limited opportunities given to transgender actors.

Trace Lysette, who stars in the Amazon series Transparent, said it was representative of a wider problem in Hollywood.

"I wouldn't be as upset if I was getting in the same rooms as Jennifer Lawrence and Scarlett for cis roles, but we know that's not the case," she tweeted. "A mess."

But Johansson's initial response was defiant, and she pointed to other actors who have taken on transgender roles.

"Tell them that they can be directed to Jeffrey Tambor, Jared Leto, and Felicity Huffman's reps for comment," she said in a statement to Bustle.

It is not the first time the actor has been criticised for taking on a role.

She was accused of "whitewashing" after being cast in the Hollywood remake of the Japanese anime Ghost in the Shell, in which she played a character that was originally written as Asian.