Free-agent guard Dion Waiters has signed a two-year, nearly $6 million contract with the Miami Heat, league sources told The Vertical.

Waiters holds a player option on the 2017-18 season and signed using the $2.9 million room mid-level exception, league sources said.

Waiters, 24, leaves Oklahoma City and gives the Heat a starting shooting-guard candidate to replace the loss of All-Star guard Dwyane Wade. The Heat’s history of building value and developing young players – including recent examples of Hassan Whiteside and Tyler Johnson – made Miami an appealing opportunity for Waiters.

For Waiters, the Heat deal is largely the result of an unrestricted free-agency process that didn’t start until most NBA teams had filled substantial salary-cap space. Oklahoma City relinquished its qualifying offer for Waiters last week to create flexibility for a possible Russell Westbrook contract renegotiation, turning Waiters from a restricted free agent to an unrestricted one once salary-cap space had dried up throughout most of the NBA.

Several interested teams, convinced of the Thunder’s determination to match an offer sheet, had been reluctant to commit to signing Waiters when Oklahoma City held matching rights.

Waiters, the fourth overall pick in the 2012 NBA draft, has constructed a strong reputation as a scorer in his stops with Oklahoma City and Cleveland, but still has work to do to convince teams of his long-term staying power. Waiters averaged 9.8 points a game for the Thunder in the 2015-16 season – three points below his career average.

Waiters has played a complementary role to superstars LeBron James, Kevin Durant and Westbrook in four NBA seasons, and now gets an opportunity to play a more significant role with Miami.

The Thunder protected themselves from the loss of Waiters with the signing of their 2013 draft pick, Spanish guard Alex Abrines – a top player in the Euroleague – and acquiring guard Victor Oladipo in a trade with the Orlando Magic.

The Associated Press first reported an agreement.

More NBA coverage from The Vertical: