Scarlett Johansson has pulled out of the film Rub & Tug after her plans to portray a transgender man prompted a backlash.

In a statement to Out.com on Friday, Johansson says she's withdrawing from the project "in light of recent ethical questions raised surrounding my casting."

Johansson was cast to play transgender man Dante 'Tex' Gill, shown here in a photo from 1979. (Pittsburgh Post-Gazette/Associated Press)

Last week, Johansson said she would star as prostitution ring leader Dante "Tex" Gill, who was born Lois Jean Gill but identified as a man.

When transgender actors and advocates questioned the casting, Johansson initially responded with a statement that criticism "can be directed to Jeffrey Tambor, Jared Leto and Felicity Huffman's reps."

All are actors who won acclaim for playing transgender characters.

"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 realize it was insensitive," said Johansson in her statement, who added that she had "great admiration and love for the trans community."

"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," she said.

Trans actress Jamie Clayton, who had been vocal about her opposition to the casting, praised Johansson on Twitter.

Cheers to learning & growing! I hope you’re still producing the film Scarlett. What an incredible opportunity to put your words into action even further! YAS! Let’s get lunch and talk! <a href="https://twitter.com/hashtag/ScarlettJohansson?src=hash&ref_src=twsrc%5Etfw">#ScarlettJohansson</a> <a href="https://t.co/rrLd6mDKDe">https://t.co/rrLd6mDKDe</a> —@MsJamieClayton

Johansson previously came under fire for playing an originally Asian character in the 2017 film Ghost in the Shell.