ORCHARD PARK, N.Y. (AP)Safety Jordan Poyer has elected to stay put by reaching a two-year agreement to re-sign with the Buffalo Bills on Wednesday after briefly testing free agency.

Poyer’s return immediately solidifies Buffalo’s secondary, which stood to lose a key leader and contributor who spent much of the previous six seasons forming one of the NFL’s top safety tandems in playing alongside Micah Hyde.

And it comes at a time with the Bills defense in transition following starting middle linebacker Tremaine Edmunds’ expected departure in free agency, and with coordinator Leslie Frazier choosing to take next season off from coaching.

The agreement represents a key free agency victory for the three-time defending AFC East champion Bills, who entered the signing period with a limited amount of salary cap space. Buffalo was projected to have about $20 million to work with after spending the past few days freeing up more than $40 million in space by restructuring the contracts of quarterback Josh Allen, edge rusher Von Miller, receiver Stefon Diggs and signing linebacker Matt Milano to a two-year contract extension.

Poyer posted a note on his social media account in announcing his return by writing, “hey bud,” in a message directed to his close friend, Hyde.

The 31-year-old Poyer has 10 years of NFL experience, and blossomed as a player upon joining the Bills in free agency in March 2017, after spending his previous three-plus seasons in Cleveland.

He’s a two-time second-team All-Pro (2017 and 2021), and Poyer’s 22 interceptions since 2017 rank fifth in the NFL. He is also the league’s only player to be credited with 500 or more tackles, have 20 interceptions and 10 sacks over that span.

In another move, a person with direct knowledge of the deal told the Associated Press that the Bills agreed to sign receiver Deonte Harty to a two-year contract that includes $5 million guaranteed and worth up to $13.5 million should he reach all the incentives. The person spoke on the condition of anonymity because the contract is not yet signed.

Harty spent his first four seasons with New Orleans where he also doubled as a returner. An undrafted free agent out of Assumption University in Massachusetts, Harty had 64 catches for 793 yards in 40 career games. His best season came two years ago when he had 36 catches for 570 yards and three TDs.

Buffalo also retained the rights to defensive back Dane Jackson, by issuing the restricted free agent a qualifying offer. The Bills hold the right to match any offer issued to Jackson by another team, and would receive a seventh-round draft pick as compensation if they decline to match.

Poyer is coming off a season in which he showed his resilience and perseverance despite being unhappy with the team’s failure to extend the final year of his contract. He played through a variety of injuries, including finishing the season with torn knee cartilage.

In October, Poyer agreed to make the 14-hour drive to play in Buffalo’s 24-20 win at Kansas City after he was prevented from flying because of the aftereffects of a collapsed lung.

Despite missing four games to injury, Poyer still finished the season leading the Bills with four interceptions and was sixth with 63 tackles. He also served as a mainstay of a young and patchwork secondary that lost Hyde to a season-ending neck injury in September, and spent the first three months minus starting cornerback Tre’Davious White who was recovering from a torn knee ligament.

The Bills defense was second in the NFL in fewest points allowed and sixth in fewest yards allowed.

AP NFL: https://apnews.com/hub/nfl and https://twitter.com/AP-NFL