NEW YORK — The “King” of Madison Square Garden has been deposed.

The New York Rangers have bought out the contract of star goaltender Henrik Lundqvist on Wednesday, parting ways with one of their greatest players in franchise history after 15 mostly spectacular seasons.

“Few players have been as important to the Rangers franchise as Henrik Lundqvist, and we are incredibly grateful for all he has done for our organization,” said James L. Dolan, executive chairman, MSG Sports. “Over his 15-year tenure, he not only established himself as one of the best goaltenders to ever play the game, he has also been one of hockey’s fiercest competitors and most effective ambassadors. He will always be a part of the Rangers family.”

In buying out the final year of the 38-year old's contact, the Rangers will save $3.7 million in cap space for next season. Lundqvist is now a free agent.

The Rangers traded veteran defenceman Marc Staal and a second-round draft choice to Detroit in the last week in another cap move.

Since joining the team in 2005-06, Lundqvist has won the Vezina Trophy (2011-12), led the Rangers to the Stanley Cup Final (2014), and been selected to the All-Star game five times. He also helped Sweden win gold at the 2006 Turin Olympics.

Lundqvist tweeted a thank you after the move and many friends congratulated him, including tennis great Roger Federer.

“15 years ago, I played my first game for @NYRangers I came here with high hopes and big dreams but in my wildest imagination, I could never have pictured the amazing ride that lay ahead..," he wrote.

Lundqvist played in 887 games, posting a 459-310-96 record with a 2.43 goals-against average. The man referred to as “The King” was limited to 30 games in this past season and had a 10-12-3 record with a career-worst 3.16 goals-against average.

“Representing this organization has been the biggest source of pride and joy in my life,” Lundqvist tweeted. “I’m so grateful for the opportunity, for the friendships and for all the great memories created wearing the red, white and blue. I will always cherish my time as a Ranger.”

Lundqvist's time with the Rangers was shortened by the play of goaltenders Igor Shesterkin and Alexandar Georgiev, who are in their mid-20s.

Lundqvist was a fan favourite at Madison Square Garden and the chants of “Hen-rik” reverberated in the arena after one of his countless spectacular saves.

“We would like to thank Henrik for his immeasurable contributions to the New York Rangers,” Rangers President John Davidson said. “From the time I met Henrik when he first came to New York in 2005, he has been the consummate professional. His tireless work ethic, passion for the game, and love of the Rangers and New York City enabled him to become one of the greatest goaltenders in hockey and one of the best players in the history of our franchise. We all wish Henrik and his family the best going forward.”

Lundqvist owns almost every record for goalies in Rangers history, including victories, shutouts (64), playoff wins and games played. He also has excelled under pressure. Lundqvist set an NHL record by winning six consecutive Game 7s, a streak that was broken by the Tampa Bay Lightning in the 2015 Eastern Conference final. He set an Olympic record for longest shutout streak (172:34) between the 2006 and 2010 Games.

Lundqvist, who plays guitar and has been known to play charity events with tennis legend John McEnroe, was a finalist for the NHL Player Foundation Award in 2014-15 for his work with the Garden of Dreams Foundation in New York. His Henrik Lundqvist Foundation strives to create positive change in the lives of children and adults throughout the world through education and health services.

___

More AP NHL: https://apnews.com/NHL and https://twitter.com/AP_Sports