ORCHARD PARK, N.Y. -- The Bills have fired coach Rex Ryan before the end of his second season after he failed to build Buffalo's defence into a bully or lead the team to the playoffs.

The Bills announced Ryan's firing on Tuesday, three days after a 34-31 overtime loss to the Dolphins dropped the Bills to 7-8 and officially eliminated the team from playoff contention. The loss extended the NFL's longest active playoff drought to 17 seasons.

Assistant head coach and offensive co-ordinator Anthony Lynn takes over as the interim, and is expected to be a candidate to replace Ryan full-time. The Bills close the season in a meaningless game on Sunday at the New York Jets (4-11).

Lynn is a longtime Ryan assistant and was promoted to offensive co-ordinator after Ryan fired Greg Roman following an 0-2 start.

Team owner Terry Pegula reached the decision over the weekend and informed Ryan during the team's day off on Tuesday.

"We mutually agreed that the time to part ways is now," Pegula said in a statement released by the team. "These decisions are never easy."

Pegula then noted his wife in saying: "Kim and I and our entire Bills organization share in the same disappointment and frustration as our fans, but we remain committed to our goal of bringing a championship to western New York."

The Pegulas made the decision to fire Ryan after attending Saturday's game and then spending Christmas at their second home in the Adirondacks.

Ryan was 15-16 in two seasons in Buffalo and is 61-66 overall. He hasn't had a winning season since his second with the Jets in 2010, when New York went 11-5 and lost the AFC Championship game for a second consecutive post-season.

Ryan was dismissed a day after he appeared emotionally drained during what became his final news conference.

He called the loss to Miami his most painful as a Bills coach, and the second-most painful in his 20 NFL seasons as a coach or assistant. Ryan also second-guessed some of the decisions he made during the game, including punting from his own 41 with a little over four minutes left in overtime. He said he hoped the loss wouldn't become his defining moment in Buffalo.

"But if it is, it's something I've got to live with," he said.

With speculation raised over the past month over his job security, Ryan also dismissed a question over whether two seasons were enough to be judged upon by the Pegulas.

"Whatever they think is fair, that's the only thing that matters," he said. "I'm just going to try to win this game. It doesn't matter that it doesn't mean anything. To me, it means a lot. I want to win the game. That's who I am."

The Bills also fired Ryan's twin brother, Rob Ryan, from his position as an assistant head coach with the responsibility to oversee defence.

Rex Ryan came to Buffalo saying this would be his last job after six seasons with the Jets, and vowed to build the Bills into a bully.

This has been a difficult year for the Ryans, who mourned the death of their father, Buddy Ryan, in June.

Buffalo's drought is tied for the fifth-longest in league history, and the longest since the New Orleans Saints failed to make the playoffs during their first 20 NFL seasons (1967-86).

The Pegulas are now on their third head coach since October 2014, when they finalized purchasing the Bills from the estate of late Hall of Fame owner Ralph Wilson.

Ryan replaced Doug Marrone, who opted out of his contract following a 9-7 finish in 2014.

The decision to switch coaches goes against the Pegulas' stated desire to have continuity in the coaching and front-office ranks, something the franchise has lacked during its playoff drought.

The Bills will now turn to their eighth coach since 2000, when Wade Phillips was fired following an 8-8 finish.

Buffalo is also on its sixth GM since 2000, with Doug Whaley completing his fourth full season at the job.

Though Buffalo's offence has featured the NFL's top running attacks over the past two seasons, Ryan was undone by his failings on defence, which was supposed to be his specialty.

Last year, the Bills finished 19th in yards allowed -- the worst ranking for Ryan in his 11 years as a head coach or co-ordinator. Buffalo also managed just 21 sacks, a franchise-low for a 16-game season, and after the defence led the NFL with 54 the previous season under co-ordinator Jim Schwartz.

The defence has underperformed once again this year, despite Ryan's off-season vows.

The Bills have allowed 30 or more points five times and allowed more than 400 yards offence four times, both matching last year's total.

Worse still, Buffalo has been porous against the run having given up 200 yards rushing to an opponent three times this season. Miami's Jay Ajayi did it twice, including a 206-yard outing on Saturday. And Le'Veon Bell had 236 yards rushing -- the most against Buffalo in franchise history -- in Pittsburgh's 27-20 win at Buffalo on Dec. 11.

Add in Ajayi's 214 yards rushing in Miami's 28-25 win in October, and the three rushing performances rank among the top-six worst against Buffalo.

Bills players had rallied to Ryan's support over the past month, and included centre Eric Wood , who made a plea for continuity.

Receiver Sammy Watkins also supported Ryan by saying he believed the team had the staff and players in place to be a contender.