ORLANDO, Fla. — Phil Jackson will have a lot of time to contemplate everything that went wrong during his three-year, three-month Knicks presidential reign as he headed off to his lakeside Montana ranch, possibly retired for good.

The Knicks officially ended the Zen Master’s rotten run Wednesday morning in a press release co-issued by Jackson and owner James Dolan, generously describing the sides “mutually agreed to part company” after “discussing the future.”

With three dreadful seasons in the books (records of 17-65, 32-50 and 31-51), Jackson said he was “deeply disappointed’’ he didn’t bring the Knicks a championship. Actually, Jackson’s three teams never even got to March still in the playoff race, and the man who won 11 NBA rings as coach ultimately lost a power struggle to a player without one, Carmelo Anthony.

“The New York Knicks will always hold a special place in my heart,” Jackson said in a statement. “This team and this town launched my NBA career. I will forever be indebted to them. I am grateful to Mr. Dolan for giving me the opportunity to return here.

“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. New York fans deserve nothing less. I wish them and the Knicks organization all the best — today and always.”

According to NBA sources, Dolan went back on his February promise to have Jackson fulfill the full five years of his contract because of new circumstances revolving around Jackson’s public feuds with the Knicks’ two best players, Anthony and Kristaps Porzingis.

Jackson became embroiled in a cold war with Porzingis, who boycotted his exit meeting, and had been publicly trying to trade Anthony.

Anthony has a no-trade clause, and without any takers, Jackson had considered using the stretch provision and waiving the 33-year-old Anthony, but ownership was not interested. With the Porzingis saga and Anthony stalemate, Dolan felt he had no choice but remove the dark cloud, Jackson’s antiquated triangle offense, and pay off the $24 million and two years left on Jackson’s pact.

Before the firing, a league executive who had talked to Knicks officials described their state entering free agency Saturday as “a roller-coaster ride where everyone better close their eyes and hope for the best.’’

Ironically, the Knicks held their first summer-league practice Wednesday with players selected because of their potential fit in the triangle offense that now will be put to rest.

Dolan said the Knicks are “currently evaluating” how to replace Jackson, and Raptors president Masai Ujiri is expected to be heavily considered. The Post has learned Liberty president Isiah Thomas would not be considered as Jackson’s successor.

General manager Steve Mills will run the organization “over the short term,” and Tim Leiweke — a veteran sports executive — has been brought in to advise the franchise on an interim basis. Leiweke, a former CEO of Maple Leaf Sports & Entertainment, hired Ujiri away from the Nuggets to become Raptors GM in 2013. He also is a friend of music mogul/Dolan pal Irving Azoff, who originally brokered the Jackson deal. Jackson’s dismissal jeopardizes the status of his top advisor, Clarence Gaines Jr., the former Bulls scout who became the Zen Master’s lone front-office hire.

“I will not be involved in the operation of the team,” Dolan vowed in Wednesday’s statement.

Mills had not yet joined the club in Orlando, and Knicks coach Jeff Hornacek, who is safe, made a statement thanking Jackson, but didn’t take questions.

Dolan praised Jackson’s legacy in basketball and thanked him for his “service” to the Knicks.

“After careful thought and consideration, we mutually agreed that the Knicks will be going in a different direction,” Dolan said.