Free-agent forward Rudy Gay has reached agreement on a two-year, $17.2 million deal with the San Antonio Spurs, league sources told ESPN.

The deal includes a player option on the second year, league sources said.

Gay has discussed deals with several winning teams, including Oklahoma City and Utah, in recent days, league sources said. The market tightened on him in the aftermath of a season-ending Achilles injury, but Gay ultimately chose the Spurs for a chance to contend in the Western Conference.

With what is essentially a one-year deal, Gay has the ability to make a full recovery, play well and return to free agency next summer.

Gay appeared to confirm the agreement in an Instagram post on Thursday.

#spurs #backtothedoubleduce A post shared by Rudy Gay (@rudygay8) on Jul 6, 2017 at 5:16pm PDT

An 11-year NBA veteran, Gay averaged 18.7 points and 6.3 rebounds in 30 games with the Sacramento Kings in 2016-17 before suffering a complete tear of his left Achilles tendon Jan. 18 against the Indiana Pacers.

Gay, who turns 31 in August, is actively rehabilitating the Achilles tear, and there's an expectation that he should be ready to return sometime in the fall. Gay opted out of $14 million in the final year of his contract with the Kings, simply ready to move on from the organization.

The Spurs used their full midlevel exception on Gay and recruited him hard since the start of July 1 free agency to finally secure a deal Thursday night, league sources said. San Antonio is desperate for athletic wing players to join All-NBA forward Kawhi Leonard to try to defend the Golden State Warriors in the Western Conference.