It’s Messy is being hailed as one of the top comedy pilots this season, sailing through production, testings and screenings as the clear frontrunner at Fox and landing on the network’s fall schedule as a likely companion to flagship comedy New Girl. How come a hot show developed at NBC, created by and starring a home-grown NBC talent, The Office‘s Mindy Kaling, ended up on Fox?

Kaling developed the project, about a Young Bridget-Jones type doctor trying to navigate both her personal and professional lives, as a starring vehicle for herself at Universal Television where she has had an overall deal stemming from her role as a co-star/writer/executive producer on the NBC/Universal TV veteran comedy series The Office. Kaling has spent virtually her entire TV career to date at NBC, coming out of the network’s diversity writing program that landed her a writing gig on The Office.

While it is an office comedy, It’s Messy has a strong female lead. By last November, before the majority of the pilot scripts commissioned by NBC, including Kaling’s, were in, the network had already given early pilot orders to three pilots with female leads, the Sarah Silverman project, Save Me and Isabel. Save Me‘s order was cast-contingent and it looked touch-and-go for awhile but, after a long search, on January 19 Anne Heche signed on to star. Four days later, NBC made the bulk of its pilot orders, including a fourth female-centered comedy, the Roseanne Barr-starring Downwardly Mobile. It may have been Roseanne vs. Mindy for the fourth and last female-lead comedy slot on NBC’s pilot slate as around the time of the Downwardly Mobile pickup, the network passed on Kaling’s script, which had made it to the final round of consideration at the network. I hear the script was a favorite of Uni TV EVP Bela Bajaria who immediately thought of pitching it to Fox as a potential companion to hot freshman New Girl. I hear it wasn’t easy getting the project released from NBC as networks tend to hold onto their rejected scripts until the end of the season for competitive reasons. But with the blessing of NBC chief Bob Greenblatt, who also oversees the studio, It’s Messy was ultimately released and on Friday, Jan. 27, Uni TV sent the script to Fox executives who read it over the weekend. On Monday, they greenlighted the pilot. I hear Fox’s Kevin Reilly had been looking to do a show with Kaling whom he considered a potential next Tina Fey.

Taking a page out of The Office playbook, the pilot cast mostly unknown to the general public actors in the supporting roles. (Chris Messina is the most known name in the cast after Kaling). Kaling, who is leaving The Office at the end of this season to segue to her Fox series, got some help from her Office friends on the pilot. Ed Helms guest starred in it, while BJ Novak served as an executive producer. Meanwhile, NBC got a comedy with a female lead on the air too — of its four pilots, one, Save Me, was picked up to series. The future will tell how It’s Messy and Save Me will do for their respective networks. As a producer, NBC would benefit greatly if Kaling’s series succeeds on Fox just as the company has reaped big profits from another Fox series produced by Universal TV, drama House, which was set up at the network by Universal right before its merger with NBC. Still, it could be awkward for hit-starved NBC to see one of its own projects do well on a competing network. Fox recently found itself in a similar situation when Don’t Trust The B—-, a script it passed on last season, was quickly scooped by ABC and went to series, which, while not a big breakout, has had a promising midseason run this spring and is expected to get renewed.

This marks the first Universal TV-produced pilot to land a series order at another network in six years, since the 2006 ABC comedy Sons & Daughters. Getting a series on an outside network was a goal of the new regime of Uni TV as the studio is transforming itself into a supplier to all networks.