TORONTO — The journey in Toronto, as many triumphs do, began with failure.

In the 2017-18 season, the Raptors won a franchise-record 59 games, riding the backs of their stars Kyle Lowry and DeMar DeRozan. They had a respected coach, Dwane Casey, who guided the franchise to its third straight 50-win season, and several promising young players. The finals loomed.

Except Toronto, as one broadcaster noted, once again became “LeBronto”: For the third straight year, LeBron James and the Cleveland Cavaliers easily brushed the Raptors aside in the playoffs on the way to the finals. Would Toronto ever get over the hump? Masai Ujiri, who has run Toronto’s basketball operations since 2013, didn’t think so, leading to a pair of the gutsiest league-paradigm-altering gambles taken by an N.B.A. executive.

First, Ujiri fired Casey four days after Casey had won the league’s Coach of the Year Award, and Ujiri eventually elevated Nick Nurse to replace Casey. But that was nothing compared with what came next: Ujiri shocked observers by trading DeRozan, Jakob Poeltl and a first-round draft pick to the San Antonio Spurs for the disgruntled superstar Kawhi Leonard (who had only one year left on his deal), the sharpshooter Danny Green and cash. In a way, the cash was the surest part of the deal.

We forget now: When Ujiri made the trade for Leonard, there was significant concern among Toronto fans and other basketball watchers, in spite of Leonard’s championship pedigree (and Green’s, for that matter).