Scarlett Johansson has withdrawn from the fact-based drama Rub & Tug after her casting as a transgender man grew intense online criticism.

The Avengers: Infinity War star was set to play Dante "Tex" Gill, who ran a massage parlor in 1970s and '80s Pittsburgh as a front for a prostitution ring. Gill lived his life as a man, preferred masculine pronouns, and may have begun transitioning at the time of his death in 2003.

RELATED: Marvel's Black Widow Movie Finds Its Director

Johansson, who faced whitewashing accusations last year for her starring role in Ghost in the Shell, was initially defiant, and through a representative last week issued a statement pointing out what she viewed as hypocrisy in the Rub & Tug criticism: “Tell them that they can be directed to Jeffrey Tambor, Jared Leto, and Felicity Huffman’s reps for comment.”

However, today in a second statement to Out magazine, announced her departure from the film, and conceded her original comments were insensitive.

"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," Johansson said. "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. I have great admiration and love for the trans community and am grateful that the conversation regarding inclusivity in Hollywood continues. According to GLAAD, LGBTQ+ characters dropped 40% in 2017 from the previous year, with no representation of trans characters in any major studio release. 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. My production company, These Pictures, actively pursues projects that both entertain and push boundaries. We look forward to working with every community to bring these most poignant and important stories to audiences worldwide."

Rub & Tug would have reunited Johansson with Ghost in the Shell director Rupert Sanders. With Johansson's departure, it's unclear whether the project will move forward.

KEEP READING: Scarlett Johansson Addresses Ghost in the Shell Whitewashing Controversy