Mark Messier may have famously helped the Rangers win the Stanley Cup, but now the hockey legend says he feels like he’s being sent to the penalty box while trying to bring the world’s largest ice-skating complex to The Bronx.

The former Rangers captain told The Post that he’s baffled over the city “reneging” on its commitment to turn over the lease to the long-shuttered Kingsbridge Armory to his development team so it can begin construction.

“I couldn’t guess what the mayor is thinking. I’ve laid up many nights wondering why,” Messier said.

The project was approved in the final days of the Bloomberg administration in 2013 — and recently stalled by Mayor Bill de Blasio and the city’s Economic Development Corp., which said it wanted to see the money first.

But Messier said his project team — including developer Kevin Parker and Olympic figure-skating gold-medal winner Sarah Hughes — needs the lease first to move ahead with its $350 million plan and keep the capital flowing.

The Kingsbridge National Ice Center would be a 750,000-square-foot complex with nine ice rinks, a 5,500-seat arena and a community center.

Many kids from low-income families would get access to free ice time and equipment, Messier said.

He said his group lined up the financing through banks and private investors, relying heavily on a federal immigration program called EB-5, which offers green cards to deep-pocketed foreigners who help fund job-creating US projects.

But after the lease signing in October 2014, the EDC decided to hold the lease in escrow until Messier’s team could come up with $158 million to finance the project’s first phase.

‘I couldn’t guess what the mayor is thinking. I’ve laid up many nights wondering why.’ - Mark Messier

The unexpected move was a “huge blow” because lenders were reluctant to open their checkbooks without his team first having a lease, Messier said.

Gov. Andrew Cuomo’s economic development arm, the Empire State Development Corp., committed to loaning $138 million, but even the state’s word wasn’t good enough.

Both sides agreed to extend the deadline to April 25 to try to resolve the dispute and avoid litigation.

EDC spokesman Anthony Hogrebe called Messier “a New York legend’’ but said, “Unfortunately, the captain’s supporting cast on this run haven’t played with the grace or skill of [former star teammates Brian] Leetch and [Adam] Graves.”

Referring to a lawsuit over ownership claims by Parker’s former business partners that was dismissed in 2014, Hogrebe said Messier’s “team has been beset by infighting and has yet to secure much of the $350 million it needs to deliver Mark’s visionary project. There have been lawsuits and countersuits. And deadlines have come and gone.”

“In the midst of all of this, in cooperation with Kingsbridge and its lender, EDC sought to protect the project and an iconic building by placing the lease in escrow until the necessary funds could be raised,” Hogrebe added. “We still hope that [Messier’s] team can deliver a great project for the people of the Bronx. EDC is committed to working with [the team] to do that and has continuously offered support. We hope [the team] continues conversations with us so the Kingsbridge project can move forward.”

Check out some of the other times the mayor left New Yorkers scratching their heads: