Kyle Lowry and the Toronto Raptors have agreed on a one-year, $31 million contract extension that takes the five-time All-Star guard out of July's free-agent market, agent Mark Bartelstein of Priority Sports told ESPN.

The extension guarantees Lowry two years and $64 million on the books -- including the $33.3 million left on his expiring contract this season.

Toronto president Masai Ujiri, general manager Bobby Webster and Lowry's camp had been motivated to hammer out an extension for months. Over the weekend, the sides closed on a deal that delivers the Raptors options as they evaluate how they'll construct a post-championship roster -- and delivers Lowry the opportunity to extend his stay with a franchise with which he's wanted to complete his career.

"We are so appreciative of how Masai and Bobby handled every aspect of this negotiation," Bartelstein told ESPN. "Once again, they displayed how they look after their players in a first-class manner, especially someone like Kyle who they recognize has such a legacy with the franchise."

Lowry had not been enthusiastic about entering the free-agent market as a 34-year-old in July. Now he gets a deal that delivers him into some historical context: He becomes the first player older than 33 to get an extension that includes a first-year salary-cap hit north of $30 million.

He still is eligible to be traded.

Lowry has earned $157 million in a career that's starting its 15th season, including his eighth as the longest-tenured active member of the Raptors.

Despite the loss of NBA Finals MVP Kawhi Leonard in free agency, the Raptors return a core that is expected to compete for the playoffs in the Eastern Conference.

Toronto still has flexibility to create a maximum salary-cap slot for 2020-21 free agency. Toronto has two key frontcourt players -- Serge Ibaka and Marc Gasol -- on expiring contracts this season. If Toronto management doesn't love its team's chances of making a deep run in the Eastern Conference playoffs, it will have the option of testing Ibaka's and Gasol's value on the trade market. The NBA's Most Improved Player, forward Pascal Siakam, is negotiating a possible rookie extension now. He is expected to be the offensive focal point of the post- Leonard Raptors.

Lowry's extension tightens the Raptors' projected salary-cap space in 2020-21, lowering it from $60 million to $26 million. Lowry is still eligible to be traded during the 2019-20 season.

Lowry joined the Raptors via trade in 2012 and has been an integral part of their unprecedented success, with five straight All-Star appearances. In the 2020-21 season, Lowry will now join a 30-30 club of elite point guards who are making over $30 million annually after the age of 30 -- including Russell Westbrook, Kemba Walker, John Wall, Steph Curry, Chris Paul and Mike Conley Jr.

ESPN front-office insider Bobby Marks contributed to this report.