The Eagles are keeping linebacker Nigel Bradham, who was set to become a free agent later this afternoon.

Bradham has agreed to a five-year contract, the team announced this morning. The deal is worth $40 million, a source said, but how much of that is guaranteed was not yet known.

The Eagles were able to retain Bradham despite salary cap restrictions. A recent restructure of tackle Lane Johnson's deal helped create additional space.

Bradham, 28, had two strong seasons for the Eagles after signing a relatively cheap, two-year contract in the 2016 offseason. He had played under Jim Schwartz for a year in Buffalo, and the Eagles defensive coordinator was prominent in bringing Bradham to Philadelphia and re-signing him.

Bradham deserves ultimate credit for garnering a long-term deal. He missed only only one game over the last two seasons — the Eagles rested in him in the meaningless 2017 regular-season finale — and he was a consistent ball hawk.

The 6-foot-2, 241-pound Bradham recorded 186 tackles, 14 passes defensed, three sacks, three forced fumbles, two fumble recoveries and an interception in two seasons in Philly.

His return could affect linebacker Mychal Kendricks, who has made it no secret that he would prefer to play more. Kendricks played more snaps last season after Jordan Hicks suffered an Achilles rupture, but Hicks is expected to be back by the start of the season.

Bradham stepped in and competently handled Hicks' play-calling duties after his departure.

However, he had a rocky start with the Eagles. Before his first training camp, he was charged with assault after he got into a physical altercation with a hotel attendant in Miami. He eventually pleaded down to a deferred prosecution program, which resulted in no jail time after the conditions were met.

A few months later, Bradham was stopped at Miami International airport when he brought a handgun through security. The misdemeanor charge was eventually dropped.

The Eagles stuck by Bradham throughout his ordeals, however, and he has avoided public off-field incidents since.