Carmelo Anthony #7 and head coach Mike D'Antoni of the...

Carmelo Anthony #7 and head coach Mike D'Antoni of the New York Knicks look on late against the Toronto Raptors during their game on Monday, January 2 2011 at Madison Square Garden in New York.(Photo by Jim McIsaac) Credit: Jim McIsaac

Long before Phil Jackson tried to get Carmelo Anthony to leave the Knicks, Anthony helped push Mike D’Antoni out of New York.

The former Knicks coach said in a long feature in “ESPN The Magazine” that he “quit” after “Anthony said the team needed to choose between him and D’Antoni.” D’Antoni resigned as Knicks coach in March 2012.

“I just went in and quit,” D’Antoni said in the story that mentioned his struggles getting through to Anthony and Kobe Bryant and covered the rebirth he’s enjoyed with the Rockets.

At the time of his resignation, the Knicks were struggling and there was discord between D’Antoni and Anthony over the equal-opportunity pick-and-roll system. D’Antoni’s system worked extremely well with Steve Nash in Phoenix and now with James Harden in Houston. But it wasn’t nearly as successful with the Knicks or Lakers.

D’Antoni was 121-167 in his 3 1⁄2 seasons with the Knicks, including 18-24 when he resigned.

D’Antoni’s system helped make Jeremy Lin a household name during “Linsanity” in 2012. But D’Antoni and Amar’e Stoudemire were among those who said players didn’t like all the attention Lin was receiving. Many believed they were referring to Anthony.

After Mike Woodson replaced D’Antoni, he ran the offense through Anthony and the Knicks went 18-6 to end the season.

Five years later, Anthony could be on his way out of New York.

Jackson, the Knicks president, tried to deal Anthony before the February trade deadline. Last month, Jackson said Anthony “would be better off somewhere else” since the Knicks are rebuilding.

NBA Players Association executive director Michele Roberts believes Jackson tried “to shame Melo out of the city.”

Anthony has a no-trade clause so he can veto any deal. But after the Knicks missed the playoffs for the fourth straight season and Anthony’s relationship with Jackson not solid, he could agree to a trade to a contender.