Scarlett Johansson has opted to withdraw from a film in which she was set to play a transgender man after her casting drew criticism from the LGBTQ community.

Johansson said an exclusive statement to Out.com that her decision was made "in light of recent ethical questions raised surrounding my casting."

CNN has reached out to Johansson's representatives for further comment.

Johansson had been set to play transgender man Dante "Tex" Gill, who owned a string of massage parlors in Pittsburgh that were fronts for prostitution in the 1970s and 1980s, in a film about his life.

Johansson's casting, however, came at a moment when the LGBTQ community and allies are encouraging the casting transgender actors in transgender roles.

The recent debut of Ryan Murphy's FX drama "Pose," which featured the largest-ever cast of transgender actors in series regular roles on a television series, has been pointed to as an shining example this practice in action.

After the immediate backlash to Johannson's casting began, the actress issued a statement to Bustle that was criticized for its dismissive nature.

In her new statement, Johansson acknowledges making a misstep.

"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," she said. "I have great admiration and love for the trans community and am grateful that the conversation regarding inclusivity in Hollywood continues."

Johansson has found herself in the middle of a casting controversy before.

Her casting in the film "Ghost in the Shell," based on a popular Japanese manga series, prompted accusations of white-washing. The movie went ahead as planned and was released in 2017.

"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," Johansson added.