Update: 5:26 p.m.
ORCHARD PARK, N.Y. -- The Buffalo Bills reached an agreement on Wednesday to hire Sean McDermott to be their next head coach.
The deal was reached shortly after the Bills interviewed McDermott for a second time in eight days. The 42-year-old has no previous head-coaching experience and spent the past six seasons working as the Carolina Panthers defensive coordinator.
McDermott replaces Rex Ryan, who was fired two weeks ago. He becomes the team's ninth head coach since 1999, when Buffalo last made the playoffs under Wade Phillips. The Bills went 7-9 this past season, extending the NFL's longest active playoff drought to 17 years.
McDermott has 18 seasons of NFL experience, spending his first 12 years with the Philadelphia Eagles. He started as a scouting coordinator for two years, then mentored under late defensive coordinator Jim Johnson. He eventually succeeded Johnson in 2009.
He takes over a team in Buffalo that featured the NFL's top running attack but an underperforming defense in two seasons under Ryan.
The Bills defense finished 19th in yards allowed two years straight, and was particularly porous against the run. Buffalo allowed 200-plus yards rushing to opposing running backs three times this season, including twice against Miami's Jay Ajayi.
The offense was inconsistent at times under second-year starter Tyrod Taylor.
Owner Terry Pegula grew so dissatisfied with the defensive meltdowns, he fired Ryan in the week leading up to Buffalo's final game. Ryan was replaced by offensive coordinator Anthony Lynn, who served as interim coach in a season-ending loss to the New York Jets.
Lynn was one of three other candidates to interview for the job besides McDermott.
Lynn was considered an initial front-runner to take over on a permanent basis, before the Bills began leaning toward McDermott, who was the first candidate the team interviewed. The Bills also interviewed Arizona Cardinals offensive coordinator Harold Goodwin and Seattle Seahawks defensive coordinator Kris Richard.
The Panthers enjoyed four straight seasons of being ranked in the NFL's top 10 in fewest yards allowed before taking a step back this season.
Carolina finished 21st in yards allowed, giving up 500-plus yards three times. The pass defense particularly suffered a drop-off following the loss of star defensive back Josh Norman, who signed with Washington in free agency. Carolina's defense was also weakened once star linebacker Luke Kuechly missed the final six games with a concussion.
The Panthers still finished sixth against the run and ranked second with 47 sacks.
In 2015, McDermott oversaw a unit that forced an NFL-leading 39 takeaways and ranked second in yards allowed. The Panthers team went 15-1 and lost to Denver in the Super Bowl.
It's uncertain whom McDermott will hire to oversee Buffalo's offense.
Another major question is McDermott's plans for Taylor.
The Bills restructured the quarterback's contract in August, giving him a five-year extension while retaining the right to opt out of the deal by March.
Potentially complicating matters, Taylor had surgery last week to repair a sports hernia. Next season's portion of the contract, worth about $30 million including bonuses, is guaranteed if Taylor is unable to pass his physical in mid-March, when the deal kicks in.
The Bills also face a potentially significant roster overhaul with 24 players eligible to become free agents this offseason. The group includes cornerback Stephon Gilmore, linebackers Lorenzo Alexander and Zach Brown, and receiver Robert Woods.