Ironman defenseman Dan Girardi, known as a gamer and a class act, agreed to a buyout of the remaining three years of his contract, clearing cap space for the team and ending a record-setting Rangers career.

“I poured my heart and soul into this team for the past 11 seasons and I enjoyed every minute of it,” Girardi, 33, said in a statement on Wednesday in which he thanked management, coaches, players and fans. “I’ve spent one-third of my life as a New Yorker. New York will always be our second home.”

A heart-and-soul defender who blocked shots fearlessly, Girardi was signed as an undrafted free agent on July 1, 2006, and ranks ninth on the Rangers all-time games played list and fifth among defensemen in career games (788), behind only Harry Howell, Brian Leetch, Ron Greschner and Jim Neilson.

A native of Welland, Ontario, Girardi skated in at least 80 games in seven seasons and he and Leetch are the only Rangers who have played all 82 games in five different seasons. Since his debut, Girardi leads the NHL in blocked shots (1,691). He also is the franchise’s leader in playoff games among skaters with 122. Henrik Lundqvist has 128.

“Dan’s contributions to the Rangers organization have been immeasurable,” team president Glen Sather said. “He has been a role model through his relentless determination, giving everything he had to this organization both on and off the ice.” By agreeing to the buyout, Girardi, whose game slowed, but not his spirit, continues to help.

Girardi’s contract carried an average salary-cap charge of $5.5 million. The buyout spreads the cost over six years. Rather than the $5.5 million for the next three years, the Rangers will be charged only $2.61 million in the 2017-18 season, $3.6 million in each of the following two seasons, and 1.1 million in the final three.

advertisement | advertise on newsday

The Rangers brass discussed, but did not ask Girardi to waive his no-move clause, which protected him from being selected by the Vegas Golden Knights in next week’s expansion draft. With the buyout, the Rangers — who can protect three defensemen, seven forwards and a goalie — are expected to protect captain Ryan McDonagh, Marc Staal (who has a no-move clause) and now Nick Holden, 30, who can play the right side and has a year remaining on his contract, worth $1.65 million.

Next season’s salary cap is expected to be about $75 million, a $2 million increase. With defenseman Kevin Klein, weighing whether to forego the final year of his contract with a $2.9 million cap charge and play in Europe, the Rangers would have even more room. It is believed that Klein, 32, who had back problems and became a part-timer this season, was being shopped for a low draft pick with no takers.

Meanwhile, restricted free agent Matt Puempel agreed to a one-year contract extension, reportedly worth about $725,000. By signing Puempel, 24, who had six goals and nine points in 27 games after being claimed on waivers from Ottawa on Nov. 21, the Rangers met a deadline for compliance with expansion rules.