BUFFALO, N.Y. (AP) Rex Ryan is switching teams - not divisions - after reaching an agreement to coach the Buffalo Bills.
A person familiar with the talks told The Associated Press the former New York Jets coach accepted in principle the Bills' contract offer after two days of discussions. The person spoke on the condition of anonymity because the Bills have not discussed their search to replace Doug Marrone, who stepped down abruptly Dec. 31.
The offer came a day after the Bills identified Ryan as a finalist and met with him for a second time in South Florida, where new owners Terry and Kim Pegula live. Ryan was one of 12 candidates to interview for the job since last weekend.
Ryan was chosen ahead of other notable candidates, including two-time Super Bowl winner Mike Shanahan, Cincinnati offensive coordinator Hue Jackson and former Bills backup quarterback Frank Reich, who completed his first season as San Diego's offensive coordinator.
At the same time, a second person familiar with the talks told the AP the Bills are negotiating to hire Greg Roman as offensive coordinator. Roman, a finalist for the Bills' coaching job, spent the past four years as the San Francisco 49ers' offensive coordinator. Roman's future is uncertain in San Francisco after coach Jim Harbaugh left to coach Michigan.
Roman is regarded as a good fit under Ryan, because the two share a similar run-first philosophy. The 49ers' running attack ranked among the NFL's top 10 in each of the past four seasons under Roman.
The Bills are coming off a 9-7 finish, matching their best record in a decade, but missed the playoffs to extend the NFL's longest active drought to 15 years.
Marrone's departure caught the Bills by surprise, when the second-year coach quit the team by using an opt-out clause in his contract.
Marrone, coincidentally, has interviewed with the Jets, where he previously served as the team's offensive line coach.
The Bills prepare to become the first of six NFL teams, including Ryan's former team, to fill their coaching vacancy this offseason.
Bills players were already expressing their support for Ryan in posts made on their Twitter accounts.
''Love the hire!'' center Eric Wood tweeted.
Running back Fred Jackson wrote: ''Excited about the hire of Rex!! Great coach to come in and keep us moving in the right direction!''
Ryan prepares to make the cross-state trip from the Big Apple to Buffalo, where he raises the profile of a franchise now on its sixth coach in 14 years.
Known for his brash personality and loyalty to his players, Ryan immediately becomes the Bills' most high-profile coach since Hall of Famer Marv Levy established his reputation in Buffalo by leading the team to four straight Super Bowl appearances in the early 1990s.
Though new to the NFL, Pegulas are not unaccustomed to making a splash. The couple, which also owns the NHL Buffalo Sabres, bought the Bills from the estate of late Hall of Fame owner Ralph Wilson's estate for a league-record $1.4 billion in October.
Ryan went 50-52, including 4-2 in the playoffs, in six seasons with the Jets before being fired along with general manager John Idzik following a 4-12 finish.
He made his biggest impact during his first two seasons in New York, when the Jets reached the AFC Championship game in consecutive years but lost them both.
Ryan is familiar with the Bills after coaching their AFC East rival. His father, Buddy, also had ties to Buffalo after spending 1961-65 as the University at Buffalo's defensive coordinator.
Like his father, Rex Ryan's strength is defense, which meshes with the Bills. Buffalo's defense finished fourth in the NFL in yards allowed last season and produced three Pro Bowl linemen.
It's unclear how Ryan's arrival would affect the status of Buffalo's current defensive coordinator Jim Schwartz, who completed his first season with the Bills. Schwartz is the former Detroit Lions coach and was a candidate for the Bills' job.
Ryan's challenge in Buffalo would be similar to the one he had in New York - providing a spark to a sputtering offense. The Jets finished 22nd in yardage last season - four spots ahead of Buffalo.
Quarterbacks were concerns for both teams, involving two players drafted in 2013 draft.
The Jets faltered behind second-year starter Geno Smith, who was eventually benched and replaced by Michael Vick for three games before finishing out the season. In Buffalo, second-year starter EJ Manuel was benched after four games and replaced by 10-year journeyman Kyle Orton, who has since said he plans to retire.
Manuel has two years left on his contract and is the only experienced starter on the roster.
AP NFL website: www.pro32.ap.org and www.twitter.com/AP-NFL