The Rangers' Ben Harpur looks into the stands as he...

The Rangers' Ben Harpur looks into the stands as he skates toward his bench after scoring a goal during the third period of an NHL game against the Bruins on Jan. 19 at Madison Square Garden. Credit: AP/Frank Franklin II

Ben Harpur signed a two-year contract extension with the Rangers on Thursday. It’s not a big deal, basically a minimum NHL salary. But to the well-traveled defenseman, having that kind of security is like hitting the lottery, especially given where he was just a few months ago and what he’s gone through to get where he is now.

“It’s nice, especially after the summer I had last summer,’’ Harpur said after Friday’s morning skate before the Rangers’ game at Madison Square Garden against the Vegas Golden Knights. “It was pretty stressful. And going through the camp that I did, and turning an AHL PTO [professional tryout] into a two-year extension, it’s a great accomplishment for me. And I’m pretty proud of myself and the way that I grinded through it all.’’

A 6-6, 231-pounder who had played in 156 NHL games before agreeing to a tryout with the Rangers for their Hartford affiliate in October, Harpur said he was “very close’’ to quitting hockey before he got that chance. He played the previous two seasons with Nashville, but last season he appeared in only 19 games for the Predators and six for their AHL affiliate in Milwaukee. He wasn’t offered a contract after the season.

With no contract offers over the summer, he accepted a tryout offer from Columbus before training camp. He didn’t earn a contract with the Blue Jackets and thought about calling it quits before the Rangers contacted him.

Harpur went to camp with Hartford, got signed and played well enough to earn a call-up to the Rangers on Dec. 3. After sitting out five games, he made his Rangers debut on Dec. 15 against Toronto, and he’s become a regular in the lineup since. His appearance against Vegas on Friday was his 19th consecutive with the Rangers.

“He’s come in and done a good, steady job for us,’’ coach Gerard Gallant said. “He’s a big guy; he’s a defender [who] makes people think when they’re on the ice, and like I’ve said, I didn’t know much about him before .  .  . He’s earned a contract, so it was good for him. Well deserved.’’

Harpur, who plays the left side on the third defense pair, partnering with Braden Schneider, entered Friday with one goal, two assists and six penalty minutes in an average of 13 minutes, 23 seconds of ice time in his first 18 games.

His stats are hardly glamorous — two goals and 16 assists in 174 NHL games — but given the way he started his junior hockey career, he’s done well to have them.

A huge growth spurt at 16 prompted his coaches to shift him from forward to defense, and in his first season with Guelph of the Ontario Hockey League, he said he played about half the games — most of those at forward — just to get him some ice time.

“Talking about it now with my coaches back then, a lot of them will say now [that] they kind of wrote me off,’’ he said. “They didn’t think that I was going to be able to do it.’’

But that summer, he put in a lot of hours on the ice and worked hard with his team’s defense coach. He improved enough that he was selected by Ottawa in the fourth round of the 2013 draft.

Even after that, his career path hasn’t been smooth. He has spent a lot of time going back and forth between the NHL and the minor leagues, and when he has been in the NHL, he spent a lot of time in press boxes as a healthy scratch.

So while he’s grateful for a steady spot now in the Rangers’ lineup, he said he’s not taking anything for granted.

“Nothing’s ever cemented in the NHL,’’ he said. “Your spot’s always on the line, and there’s thousands of guys that are coming for your job, you know? So I have that mindset where every day is a trial for me.’’

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 6 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME