Following a lengthy casting search and dealmaking process, CBS has found its Nancy Drew.

Person of Interest star and The L Word alum Sarah Shahi has been tapped to play the iconic sleuth in the network's Drew pilot, The Hollywood Reporter has learned.

The drama, based on the beloved book series, finds Nancy (Shahi) now in her 30s and serving as a detective for the NYPD, where she investigates and solves crimes using her uncanny observational skills, all while navigating the complexities of life in a modern world.

Like in the books and previous big- and small-screen adaptations, Nancy grew up solving crimes with her two childhood girlfriends, Bess and George. CBS' take finds Nancy joining the NYPD after college, where she was named the youngest female NYPD homicide detective. She was a star — until she arrested the wrong guy, was publicly called on it and quit the force. Drew will find her struggling to find a way back to the confident character she's best known as to audiences worldwide.

CBS Entertainment president Glenn Geller told THR in January that the network's Nancy Drew would be diverse — and Shahi fits that bill. The Persian actress, who portrayed a fixer attorney on USA Network's Fairly Legal and played a detective on NBC's Life, was born and raised in Texas. Her father is from Iran, while her maternal grandfather is Persian and her maternal grandmother is from Spain. Shahi's credits also include Showtime's Ray Donovan, NBC's Chicago Fire and CBS' Person of Interest, where she starred as a government assassin. The casting keeps Shahi in the CBS fold as the actress, who in 2014 took maternity leave from Person of Interest, is poised to return to the drama for its likely fifth and final season. (A return date for the series has not yet been determined.) She is repped by CAA, McKeon-Myones Management and Meyer & Downs.

Shahi becomes the latest actress to portray Nancy Drew, who was most recently played by Emma Roberts in the 2007 feature film. The character first appeared in books in 1930 and was created by Edward Stratemeyer. The novels have been ghostwritten by a series of authors and published under the pseudonym Carolyn Keene. The character has evolved in the decades since, though the original series — Nancy Drew Mystery Stories — ran from 1930 to 2003. The franchise has included spinoff series including Nancy Drew Files and collaborations with the Hardy Boys.

The character spawned a TV series — The Hardy Boys/Nancy Drew Mysteries — that ran for three seasons on ABC in the late 1970s starring Pamela Sue Martin (and later Janet Louise Johnson) as well as Shaun Cassidy and Parker Stevenson. The series was an anthology of sorts, with some episodes focusing only on Nancy Drew, and others on amateur sleuth siblings Frank and Joe Hardy. The series was produced by Glen A. Larson Productions and distributed by Universal Television. (Larson passed away in November.)

CBS' Drew is written and executive produced by husband-and-wife duo Joan Rater and Tony Phelan (Grey's Anatomy); Dan Jinks also exec produces the CBS Television Studios drama. ER's Anthony Edwards co-stars as Nancy's adoptive father, while Graceland's Vanessa Ferlito is set as George. Felix Solis plays a fellow detective.

Keep up with all the latest pickups, castings and eventual series orders with THR's handy guide to pilot season.