NEW YORK — Phil Jackson wanted to trade Carmelo Anthony and wouldn’t rule out dealing Kristaps Porzingis.

Turns out, Jackson is the one leaving.

Jackson is out as New York Knicks president after he oversaw one of the worst eras in team history, with the team saying in a statement Wednesday that they had “mutually agreed to part company.”

Days after Jackson reiterated his desire to move Anthony and said he would listen to deals for Porzingis, Madison Square Garden chairman James Dolan reversed course and cut ties with Jackson with two years remaining on his contract.

“After careful thought and consideration, we mutually agreed that the Knicks will be going in a different direction,” Dolan said. “Phil Jackson is one of the most celebrated and successful individuals in the history of the NBA. His legacy in the game of basketball is unmatched.”

But his work as a first-time executive was awful. The winner of an NBA-record 11 championships as coach, Jackson couldn’t engineer one playoff berth while running the Knicks. The team was 80-166 in his three full seasons, including a franchise-worst 17-65 in 2014-15.

His departure was quickly welcomed by Knicks fans such as film director Spike Lee, who posted a picture of himself on Instagram in a celebratory pose after it was first reported by The Vertical.

The move comes less than a week after Jackson led the Knicks through the NBA draft and on the eve of free agency that opens Saturday.

Dolan said he would not be involved in the operation of the team, adding that General Manager Steve Mills would run the day-to-day business in the short term and that former Toronto executive Tim Leiweke would advise him and help develop a plan going forward.

Jackson was a Hall of Fame coach with the Chicago Bulls and Los Angeles Lakers. He also played for the Knicks when they won NBA titles in 1970 and 1973.

He was welcomed back to the organization with a $60 million contract to huge fanfare in March 2014, but it soon became clear the transition would be a poor one. His first coaching hire, Derek Fisher, lasted less than two seasons, and Jackson’s trades and free agency moves also failed to improve the club.

“I had hoped, of course, to bring another NBA championship to the Garden. As someone who treasures winning, I am deeply disappointed that we weren’t able to do that,” Jackson said.

“New York fans deserve nothing less. I wish them and the Knicks organization all the best – today and always.”

ROCKETS: Chris Paul is heading to Houston to join James Harden, and the Rockets will soon have two All-Stars in the backcourt to lead their chase for a championship.

The Rockets acquired Paul from the Clippers in exchange for Patrick Beverley, Lou Williams, Sam Dekker, Montrezl Harrell, Darrun Hilliard, DeAndre Liggins, Kyle Wiltjer, a protected first-round pick next year and cash considerations.

The 32-year-old Paul opted in for the last year of his contract so the Clippers could work on a deal.

The Rockets acquired Hilliard from Detroit and Liggins from Dallas for cash considerations on Wednesday before adding them to the deal for Paul.

The nine-time All-Star has averaged 18.7 points, 9.9 assists, 4.4 rebounds and 2.3 steals over his 12-year career.

Houston also acquired swingman Darrun Hilliard from the Pistons in exchange for cash considerations.

Hilliard appeared in a career-high 39 games last season, averaging 3.3 points, 0.8 rebounds and 0.8 assists in 9.8 minutes.

RAPTORS: Toronto promoted Bobby Webster to general manager, making the 32-year-old assistant the youngest GM in the NBA.

He replaces Jeff Weltman, who left Toronto in May to become president of the Orlando Magic.

A former staffer at the NBA league office in New York, Webster joined the Raptors in 2013 and was named assistant GM in 2016.