DeMar DeRozan turned the biggest year of his career into a very big contract.

The All-Star shooting guard is staying with the Toronto Raptors and agreed early Friday on the basic framework of a five-year deal, a person with knowledge of the negotiations told The Associated Press.

DeRozan and the Raptors still had some financial terms to complete but the sides agreed that he would be staying put, according to the person who spoke on condition of anonymity because the talks were ongoing.

USA Today Sports first reported that DeRozan and the Raptors had reached a deal.

DeRozan can sign on or after July 7, when the league’s offseason moratorium on player movement expires. He averaged a career-best 23.5 points this past season, becoming only the third Toronto player to ever score at such a pace — joining Vince Carter and Chris Bosh.

Keeping DeRozan was an absolute top priority for the Raptors. He’s wildly popular in Toronto and has been throughout each of his first seven pro seasons, but probably never more than he is now. The Raptors are coming off the best season in team history, when they won 56 games and were one of the NBA’s last four teams left in the postseason.

advertisement | advertise on newsday

DeRozan and Kyle Lowry — not just his Toronto teammate, but also an Olympic teammate for USA Basketball this summer in Rio — have become one of the league’s top backcourts. And despite playing with an injured thumb, DeRozan came up huge in several games for the Raptors in this year’s playoffs. He scored 28 or more points six times in the postseason; the Raptors went 6-0 in those games.

It was widely speculated that DeRozan would look elsewhere, possibly at the Los Angeles Lakers since he’s a Southern California native. But even on the night when Toronto was eliminated from the Eastern Conference finals by the eventual NBA champion Cleveland Cavaliers, DeRozan suggested that he would not be going anywhere.

“We’re looking forward to it,” DeRozan said when asked about the Raptors’ future.