Photo: Detroit Pistons/X

Free agent forward Tobias Harris has agreed to a two-year, $31 million contract with the San Antonio Spurs, according to ESPN.

Harris leaves the Pistons after playing a key role in the franchise’s turnaround and now joins a young San Antonio team looking to compete in the Western Conference.

In 63 games, he averaged 13.3 points, 5.1 rebounds, and 2.5 assists while shooting 46.9 percent from the field and 36.8 percent from three-point range.