Two weeks after firing Rex Ryan, the Buffalo Bills have found his replacement.

CBS Sports NFL Insider Jason La Canfora reported Wednesday afternoon that Sean McDermott has agreed to become the next coach of the Bills. The 42-year-old coach will take over in Buffalo after spending the past six seasons as the defensive coordinator for the Carolina Panthers.

The Bills officially announced the move later Wednesday.

The hiring of McDermott ends a 15-day process that started when Bills offensive coordinator Anthony Lynn was named interim coach after Ryan's firing on Dec. 27. At first, Lynn was believed to be a front-runner for the job, but the Bills decided to go in a different direction.

Instead of going with an offensive mind like Lynn's, Buffalo once again turned to a defensive coach.

During six seasons in Carolina, McDermott led a defense that finished top 10 in the NFL three times. That total includes a dominating 2015 season where the defense helped pave the way for a Super Bowl run with a unit that ranked sixth overall.

Under McDermott's direction, the Panthers went 15-1 in 2015 with a defense that led the league in interceptions (24) and takeaways (39).

The first thing McDermott is probably going to want to do when he gets to Buffalo is make the defense less complicated. One of the main complaints Bills players had about Ryan was that his defense was overwhelming.

After Ryan was fired, Bills defensive lineman Marcell Dareus said Ryan's calls were just too complicated.

"It was just too much detail for a lot of guys, and I feel like for a lot of guys it was too much going on for them to check here and check there, if this happens and that happens," Dareus said. "Then nine times out of ten, a team will throw something out there that we weren't prepared for, and then the adjustment to it, we had to get use to and try to make it happen and make plays."

Despite Ryan's defensive mind, the Bills regressed with him running the show. After ranking fourth overall in the NFL in points surrendered in 2014, the team dropped to 15th in 2015 and 16th in 2016 under Ryan.

The Bills might have tabbed McDermott because they feel he's the perfect coach to come in and clean up Ryan's mess. To help run the defense in Buffalo, McDermott will likely bring in Panthers linebackers coach Al Holcomb to serve as defensive coordinator, La Canfora has reported.

In Carolina, assistant head coach Steve Wilks is likely to replace McDermott as defensive coordinator, according to ESPN.com.

Buffalo will be McDermott's third stop in his coaching career. Before joining Carolina, McDermott spent 12 seasons with the Eagles. McDermott started in Philly as scouting administrative coordinator in 1999 before moving all the way up to defensive coordinator in 2009.