"Don't Worry Darling" director Olivia Wilde has revealed why Shia LaBeouf left the movie. The actor was later replaced by singer Harry Styles.

Wilde, who also acts in the movie, claimed LaBeouf gave her an "ultimatum" to choose between him and actress Florence Pugh (who played Styles' wife in the movie). She eventually chose Pugh over LaBeouf.

The director explained that at the initial stages of filming, she tried to "mediate a situation between people to try to see if they can work together happily."

"Once it became clear that it was not a tenable working relationship, I was given an ultimatum, I chose my actress, which I'm very happy I did," the 38-year-old director said when she appeared on "The Late Show with Stephen Colbert" on Wednesday.

When the show host asked Wilde whether LaBeouf quit the movie or she fired him, she responded, "We had to replace Shia. He is a fantastic actor, but it wasn't gonna work."

After LaBeouf asked her to pick between him and Pugh, the director decided to go ahead with the actress.

"And that was him feeling he was stepping away and me feeling like we were moving on without him," Wilde added.

"It's a question of semantics," the director explained. "It wasn't going to move forward in the way that he wanted it to, and so he had to leave."

Wilde explained such issues aren't new as they happen "all the time" during the movie-making process and "anyone who's ever dealt with conflict knows that there are levels to it before there's a conclusion."

In this case, everyone seemed happy as they got what they wanted, she noted.

"He didn't want to be a part of the production we were making in the way I like to make productions, and so he moved on," Wilde added. "We moved on and replaced him and ended up with a cast that I'm so proud of in a movie I'm really thrilled about."

"Don't Worry Darling" will release this Friday in theaters. It will start streaming on HBO Max 45 days after its theatrical release.

Shia LaBeouf was arrested during his livestreamed anti-Trump protest early Thursday morning at the Museum of the Moving Image in Queens, New York. Labeouf attends a news conference to promote the film Man Down at the Toronto International Film Festival in September 2015. Reuters/Fred Thornhill