After a two-and-and-a-half-year journey at different networks with different writers, the drama adaptation of Leif G.W. Persson’s best-selling Backstrom series of books is finally heading to the screen with a 13-episode order at Fox. The network, which first developed the project during the 2011-12 season, has stepped in to pick up the pilot starring The Office‘s Rainn Wilson, from Bones creator/exec producer Hart Hanson and 20th Century Fox TV, which was ordered by CBS last season. The series centers on Detective Everett Backstrom (Wilson), an offensive, irascible detective, as he tries, and fails, to change his self-destructive behavior. Throughout the series, Backstrom leads his team, the Serious Crimes Unit, as they navigate Portland’s most sensitive cases. The entire cast led by Wilson is set to continue with the exception of Mamie Gummer whose character is being tweaked. Hanson is expected to focus his attention on Backstrom, with his top Bones lieutenant Stephen Nathan, who has performed day-to-day showrunner duties on the long-running Fox procedural, including while Hanson ran Bones spinoff The Finder, taking lead, with Hanson having a final say on major decisions.

The project sparked a slew of bidding wars ever since the Backstom books were shopped by LA literary agency RWSG in summer 2011 — when 20th TV won them in a very competitive situation for Stephen Gaghan to adapt. The project with Gaghan as writer triggered another round of heated bidding among all four major networks until landing at Fox with a put pilot commitment for the 2011-12 season but didn’t go to pilot. In July 2012, with Hanson as writer/showrunner, 20th TV again garnered a lot of interest, landing a pilot production commitment at CBS where the script went to pilot last season. After a lengthy and difficult casting process, the pilot got Wilson for the lead and was considered a solid contender but didn’t make the cut to series in May. 20th TV remained high on the project, extending the options on the entire cast through the end of 2013. But it couldn’t make a move as CBS did not release the pilot until its option expired on December 15 when the studio took the project to its original network, Fox, which quickly began negotiations on a series order. “Naturally, all of us who worked on Backstrom thought it was too promising a series to die unseen and (20th TV chairmen) Dana (Walden) and Gary (Newman) were relentless in their support of the project,” said Hanson. “Imagine our delight to find that Kevin Reilly and his team at Fox agreed enough to pick it up and give us a good home. Thanks Fox!”

The network already has a strong relationship with Hanson, creator of veteran procedural Bones and its spinoff The Finder. “Hart Hanson and Rainn Wilson are the perfect combination of creative vision and on-screen talent to bring this one-of-a-kind character and story like Backstrom to Fox,” said Fox chairman Reilly. “I’ve been in business with Hart for a long time, and not only does he have a rare gift for infusing darker themes with relatable humor, he’s one of the best showrunners out there today.” Added 20th TV chairmen Dana Walden and Gary Newman, “There are so few creators out there with the genuine ability to mix great procedural storytelling with humor, and Hart Hanson is one of those guys. Getting another show on the air with him has been a top priority of this company.”

Backstrom reunites Wilson with his Office co-star Mindy Kaling, who toplines Fox’s The Mindy Project, and Reilly. “Fox is the perfect home for this fun and disturbed piece of entertainment,” Wilson said. “They are passionate about the show and I’m ecstatic to be working with Kevin Reilly again (he launched The Office on NBC and fought tooth-and-nail for us to stay on the air, let’s not forget) and to be on the same network as my frenemy, Mindy Kaling.”

Hanson serves as executive producer on the series with Persson and Niclas Salomonsson, while Wilson will serve as producer alongside Josh Levy. Mark Mylod served as director and executive producer on the pilot. Production is scheduled to begin soon. Co-starring on the show are Kristoffer Polaha, Dennis Haysbert, Page Kennedy and Beatrice Rosen.

Fox already has two drama series locked in for next season with Backstrom and Hieroglyph, with another one, Gotham, expected to join them as it has a pilot order with series penalty. Add to that Fox’s event drama series, and the network doesn’t have a lot of drama needs for next season though it will likely expand its scripted footprint as The X Factor is expected to shrink to one night a week.