Adam Schefter describes the series of events that led to Richard Sherman signing a three-year contract with the 49ers. (0:49)

Richard Sherman has agreed to a three-year contract with the San Francisco 49ers. The free-agent cornerback told ESPN's Josina Anderson on Saturday that the incentive-laden deal is worth up to $39.15 million.

"I'm thankful to John [Lynch, 49ers GM] and Kyle [Shanahan, 49ers coach] for believing in me," Sherman told Anderson. "Some smaller details still getting ironed out, but #ShermInTheBay."

The 49ers made the signing official on Sunday.

"Richard is one of the premier competitors Kyle and I have ever encountered," general manager John Lynch said in a statement. "We look forward to him sharing his wealth of experience and his passion for the game of football with our team. Richard has long been looked at as the prototypical corner in our scheme, and the opportunity to have him mentor our players was one we needed to attack. Most importantly, we are excited to have a championship-caliber corner on the field for the 49ers."

The 49ers met with Sherman on Saturday and wanted to make sure he is healing well from a torn Achilles in his right foot and a bone spur in his left. On Friday, Sherman told Anderson that he will be back running on the treadmill next week.

Sherman and the 49ers both expect that he will be ready for training camp, sources told ESPN's Adam Schefter, who first reported the agreement between the sides.

After being released Friday by the Seahawks, Sherman said he had received preliminary interest from the Titans, Lions, Raiders, Texans, Buccaneers and Packers, as well as the 49ers. San Francisco ended up being the choice, which means two games against his former team in Seattle each regular season.

In adding Sherman, the 49ers filled what was arguably the biggest hole on their team with the most proven veteran cornerback on the market. San Francisco allowed a Total QBR of 87 last season, second-worst in the league. At the NFL scouting combine, Lynch said it didn't take a "savant" to see the team's need at the position.

With Dontae Johnson, who started all 16 games a year ago, set to become a free agent, the Niners entered this offseason with Ahkello Witherspoon and nickelback K'Waun Williams as their only corners under contract with extensive league experience (four years between them).

Sherman has a long history with the Bay Area, having played college football at nearby Stanford before becoming one of the Niners' biggest adversaries during the heated Seahawks-Niners rivalry that spanned from 2011 to 2013.

Upon his arrival in San Francisco and a return to health, Sherman will be expected to hold down a starting cornerback spot opposite Witherspoon in coordinator Robert Saleh's defense. Saleh and Sherman have a previous relationship from Saleh's time as a defensive assistant in Seattle.

Because Saleh runs the Cover 3 defense Sherman spent most of his time playing with the Seahawks, the Niners don't expect the veteran cornerback to have to make much of an adjustment in terms of scheme.

One of the most accomplished cornerbacks of his generation, Sherman made four Pro Bowls and was named a first-team All-Pro three times during his seven seasons with the Seahawks, who drafted him in the fifth round in 2011. His 32 interceptions in that span are first among NFL players, as are his 99 passes defended, according to the NFL.

Sherman was an instrumental figure in Seattle's historically good defense, which allowed the fewest points in the NFL every year from 2012 to 2015. During his seven seasons with the team, the Seahawks made five playoff appearances, reached two Super Bowls and delivered Seattle its first NFL championship.

ESPN's Nick Wagoner contributed to this report.