“Quantico” has been renewed for a third season at ABC. The Priyanka Chopra-led espionage drama has received an order for an abbreviated run of 13 episodes.

With the renewal, creator and executive producer Josh Safran will exit his role as showrunner on the series. He will remain with the show’s third season as a consultant. A search for a new showrunner for the ABC Studios drama is underway.

“Quantico” was the one series from ABC’s 2016-17 whose fate remained unresolved heading into this week’s upfront presentation in New York after ABc issued a flurry of renewals, cancellations, and new series pickups last week.

Season two of “Quantico” has averaged a 0.7 rating in the 18-49 demo over 21 episodes, according to Nielsen live-plus-same day numbers. That’s down 45% from the first season of the show. Season two also averaged 2.8 million total viewers, down 36 percent from the previous season.

With its pickup of “American Idol,” slated according to sources for around 40 broadcast hours next spring, ABC faces a scheduling crunch heading into its upfront presentation in Lincoln Center. The series join previously renewed ABC comedies “Black-ish,” “Modern Family” (for two seasons), “American Housewife,” “Fresh Off the Boat,” “Speechless,” “The Goldbergs” (for two seasons), and “The Middle,” along with dramas “Once Upon a Time,” “Designated Survivor,” “Agents of SHIELD,” “Grey’s Anatomy,” and “How to Get Away With Murder.” “Scandal” had previously been renewed for season seven, which will reportedly be the show’s last. The network has canceled “The Real O’Neals,” “Imaginary Mary,” “The Catch,” “Dr. Ken,” “Last Man Standing,” “American Crime,” and “Secrets and Lies.” ABC had previously canceled freshman dramas “Time After Time,” “Notorious,” and “Conviction.”