Teams often talk about needing a player like the Warriors’ Draymond Green, whose new deal runs through 2024.

Photo: Carlos Avila Gonzalez / The Chronicle

Draymond Green agreed to a four-year, nearly $100 million maximum contract extension with the Warriors, two league sources confirmed to The Chronicle on Saturday.

The versatile and volatile 29-year-old forward, whose unbridled passion has made him a fan favorite but also a lightning rod for criticism, was set to become a free agent after the 2019-20 season, in which he’ll make $18.5 million. The new deal will pay him $22.2 million, $24 million, $25.8 million and $27.6 million over the following four seasons, The Chronicle confirmed.

ESPN was first to report the news, citing Green’s agent, Rich Paul of Klutch Sports.

The Warriors now have deals with three All-Stars from their championship core through the 2021-22 season, after which Stephen Curry is set to become a free agent.

Green, a three-time All-Star, 2016-17 Defensive Player of the Year and key part of three Warriors championships, struggled to find his shot last season but persisted as an elite stopper and skilled playmaker. He came on strong after committing to improve his conditioning, losing 23 pounds in six weeks before the playoffs.

After going without a triple-double in the regular season, he had six in the postseason, including two in the NBA Finals. Green’s 10 career postseason triple-doubles are by far a franchise record; Tom Gola had three, and Curry, Kevin Durant and Guy Rodgers each have recorded one.

Green averaged 13.3 points, 10.1 rebounds and 8.5 assists last postseason, all up significantly from his regular-season marks of 7.4, 7.3 and 6.9. The uptick in production helped silence some of his doubters who said he was past his prime after he failed to earn an All-Star selection for the first time in the past four seasons.

Green and Curry, 31, will open Chase Center in San Francisco this fall as elder statesmen on a remade Warriors roster that features eight players who have four seasons or fewer of NBA experience, including All-Star guard D’Angelo Russell, 23.

Green has been the team’s emotional leader, and that same raw intensity has sometimes worked to his detriment. In November, he drew a one-game suspension for a profanity-laced tirade at Durant that started on the court and continued in the postgame locker room. Green has also been among the league leaders in technical fouls. And few will forget his suspension for Game 5 of the 2016 NBA Finals for hitting LeBron James in the groin.

Green worked to contain his outbursts during this season’s playoffs, but still came within one technical foul of a suspension in the NBA Finals.

“I just want to direct my energy toward more positive things,” Green said during the Western Conference finals. “It’s funny because when the stuff happened with Kevin this year, everyone just laughed like, ‘Oh, that’s just Draymond. He’s emotional.’ Kevin said to me, ‘You’re not emotional, I’ve seen you locked in and not say a word to the referees. So I’m not giving you that pass.’ That stuck with me, too. I’m trying to be mindful of that.”

Green switched agents in February when he signed with Paul, one of the league’s most powerful deal-makers whose decision to go public with Anthony Davis’ trade request in January drew criticism, including recently from Warriors head coach Steve Kerr.

Green reiterated his desire to stay with Golden State in May during the Western Conference semifinals when he told reporters, “I want to be here. I been saying that.”

That came a day after the Athletic quoted Warriors majority owner Joe Lacob as saying, “I want Draymond Green to be here forever. He’s as Warrior as they come.”