The Batman origin story will get one final chapter on  Fox. The network has ordered a fifth season of Gotham, which will be the DC Comics drama’s last. Said to be 13-episode and eyed for midseason, the final season will focus on Bruce Wayne’s transformation into the caped crusader

This was the second 11th-hour renewal for a Warner Bros TV drama by Fox today, just hours before the network’s upfront presentation to tomorrow. The network also picked up Lethal Weapon, with Seann William Scott replacing original co-star Clayne Crawford, so of its three Fox series, only cult favorite Lucifer was canceled.

Per the producers — “the fifth and final season will wrap up this unique origin story of the great DC Comics Super-villains and vigilantes, which revealed an entirely new chapter that has never been told.”

Boosted by the popularity of its IP, Gotham got off to a strong start in fall 2014. Its ratings have been dipping since — its season-to-date average is a 1.4 rating among adults 18-49 (Live+7) vs. 1.9 last season. Still, Gotham has been doing a solid business in multi-platform viewing and has done well with male demos. Its multi-platform audience is 5.8 million  (up +115% from Live + Same Day).

After three seasons on Monday, Gotham was moved to Thursday this season. Fox Chairman Gary Newman addressed the series’ future in a March interview with Deadline. “We asked a lot of it this year moving to Thursday nights and I thought it did a pretty good job of opening up that night for us.” At the time he called a decision on where Gotham would return as “purely be a matter of scheduling.”

Gotham is an important asset for producer Warner Bros. TV, which has a huge Netflix deal for the show. It was the first SVOD pact for a broadcast series made before its premiere. Estimated to be worth about $1.75 million an episode, it made Netflix the exclusive subscription video on demand home of the Batman prequel in the U.S. as well as in the territories in which the streaming network operates

Produced by Warner Bros. TV and based on characters from DC Comics, Gotham is executive produced by Bruno Heller, who developed the series, Danny Cannon and John Stephens. The series large ensemble cast includes Ben McKenzie, Donal Logue, Morena Baccarin, Sean Pertwee, Robin Lord Taylor, Erin Richards, David Mazouz, Camren Bicondova, Cory Michael Smith, Jessica Lucas, Chris Chalk, Drew Powell, Alexander Siddig and Crystal Reed.