Carmelo Anthony didn’t come close to achieving his goal of leading the Knicks to a championship, so he’s moving on to chase one for himself.

The Anthony Era ended Saturday after the Knicks and Oklahoma City Thunder agreed on a trade for the 10-time All-Star, league sources confirmed. The Knicks are sending Anthony to Oklahoma City for center Enes Kanter, shooting guard Doug McDermott and the 2018 second-round pick that the Thunder acquired from Chicago.

The deal was agreed upon, but won’t be official until Monday, which is when the Knicks will hold their annual Media Day.

The Knicks open the regular season on Oct. 19, against Anthony and the Thunder.

Anthony, who has a no-trade clause in his contract, initially had listed Houston as his preferred destination. But when the Knicks and Rockets couldn’t reach an accord, they asked Anthony to expand his list. He did recently to include Oklahoma City and Cleveland.

Anthony will waive his no-trade clause and trade kicker, the source said. ESPN.com was first to report all the particulars of the trade.

After missing the playoffs for the past four seasons, Anthony has a chance to go deep into the postseason with the Thunder. He will team with league MVP Russell Westbrook and Paul George, who Oklahoma City acquired over the summer, to make a formidable trio in the loaded Western Conference. They hope to have enough firepower to challenge the NBA-champion Warriors.

The Knicks now can begin their youth movement for real, and they will officially become Kristaps Porzingis’ team.

They’ve been saying they’re building around Porzingis, Willy Hernangomez, Tim Hardaway Jr. — who they signed to a four-year, $71 million contract this summer — first-round pick Frank Ntilikina and Ron Baker. They’re all 25 or younger. It would be difficult to do that if Anthony was still on the roster.

Knicks president Steve Mills said Friday that “our plan” was that Anthony would be on the team when camp opened, and coach Jeff Hornacek said he would remain a starter.

But things changed quickly as both sides felt a sense of urgency to get something done. Mills and new general manager Scott Perry were able to find a deal that they liked and Anthony would accept.

The snag with the Rockets was the Knicks wouldn’t take back Ryan Anderson and the three years and $60 million he had remaining on his contract. They also couldn’t find a third team to take him.

Kanter has averaged 11.3 points and 6.7 rebounds in six NBA seasons with the Jazz and Thunder. He has two years and $36.6 million remaining on his contract. The second year is a player option. McDermott, who is in the final year of his rookie deal, has averaged 8.0 points in three seasons for the Bulls and Thunder while shooting 39.4 percent from three-point range,

Anthony was acquired by the Knicks in February 2011. He played in 412 games over parts of seven seasons with the Knicks. He made the All-Star team each season and established a franchise and Madison Square Garden scoring record when he poured in 62 points Jan. 23, 2014 against Charlotte

Anthony ends his Knicks’ career seventh all-time in points scored (10,186) and third in points per game (24.7). But Anthony’s time with the Knicks were mostly filled with disappointment, frustration and unfulfilled expectations.

The Knicks reached the playoffs in his first three seasons, but they won only one series.

Former Knicks president Phil Jackson made it clear that the Knicks needed to move on from Anthony. But Jackson wanted it to happen sooner than later and reportedly was willing to buy out Anthony, who has two-year and $54 million left on his contract. That ultimately led to Jackson and the Knicks parting ways.

The Knicks wanted to make sure they got something back for their best player if they moved him.

Anthony came to the Knicks in a massive three-team trade that also included Minnesota and featured 13 players, four draft picks and cash.

The Knicks broke up a good young team and sent Danilo Gallinari, Wilson Chandler, Timofey Mozgov and Raymond Felton to Denver for Anthony. They believed the tandem of Anthony and Amar’e Stoudemire would be a formidable pairing that could be the nucleus of a championship contender.

But it never materialized due to injuries and the two All-Star’s games’ not meshing.

The Knicks’ best season with Anthony was 2012-13. They won 54 games and the Atlantic Division title, and Anthony, who led the league in scoring averaging 28.7 points that season, finished third in the MVP voting. The Knicks also won their first playoff series since 2000. But they lost to Indiana in the conference finals.

It went downhill from there as age, injuries, front-office shake-ups, coaching changes and roster overhauls contributed to the Knicks stumbling the last four years.

Jackson took over as team president in 2014, and that summer re-signed Anthony to a five-year, $124 million deal that included a no-trade clause and a 15-percent trade kicker.

Anthony believed Jackson, with his championship pedigree as a coach, would turn the Knicks into contenders. That never happened. The Knicks went 80-166 under Jackson’s watch and his relationship with Anthony soured.

After the acquisitions of Derrick Rose, Joakim Noah, Courtney Lee and Brandon Jennings last offseason, the Knicks believed they had assembled a team that could not only reach the playoffs, but win a round or two. The Knicks started 14-10, but then nose-dived in the standings. They went 17-41 the rest of the way.

Anthony became the scapegoat for the Knicks struggles, though.

After the season, Jackson said of Anthony, “We have not been able to win with him . . . He is a player that would be better off somewhere else and using his talents somewhere where he can win or chase that championship.”

Anthony ended up doing that, but Jackson wasn’t around to send him packing. Mills and Perry accomplished that.