Bryan Singer has just closed a deal to direct "X-Men: Apocalypse" for 20th Century Fox.

Due to allegations of sexual assault filed by Michael Egan against the filmmaker just weeks before the opening of "X-Men: Days of Future Past," it was believed that the film studio might look for another director to helm the next installment of the franchise. But the lawsuit was withdrawn last month, and both camps have come to an agreement that Singer will return in the "X-Men" director's chair.

20th Century Fox production president Emma Watts told The Hollywood Reporter in June that she wanted Singer to direct the sequel, despite the scandal. "Nothing would make me happier than if it all worked out. It's always been the intention for him to do it," she said.

The script for "X-Men: Days of Future Past" is being written by Simon Kinberg from a story developed by him, Singer, Michael Dougherty and Dan Harris. Singer and Lauren Shuler Donner are producing with Kinberg and Hutch Parker, Deadline reported.

The next installment of the series takes place 10 years  after "X-Men: Days of Future Past," whose time travel shenanigans have reset the X-Men universe and unleashed a new and uniquely powerful enemy named Apocalypse. The villain was introduced in a coda in the previous installment.

Charles (James McAvoy), Erik/Magneto (Michael Fassbender), Raven/Mystique (Jennifer Lawrence), Wolverine (Hugh Jackman) and Hank/Beast (Nicholas Hoult) are joined by younger versions of Cyclops, Storm, Jean and others as they must fight Apocalypse, "an ancient unrelenting force determined to cause an apocalypse unlike any in human history," according to Deadline.

"'Apocalypse' will have more of the mass destruction that 'X-Men' films, to date, have not relied upon," Singer recently told Total Film magazine via Variety. "There's definitely now a character and a story that allow room for that kind of spectacle."

"I call these movies in-between-quels. It's a mind-f**k sometimes in terms of where things fall in the timeline," he added.

Production begins early next year, and the film is slated for a May 27, 2016 release.

"X-Men: Days of Future Past," which had a production budget of $200 million grossed $233.9 million in the US and  $512.1 million in international markets.