TORONTO — The NHL will allow the Toronto Maple Leafs to place Joffrey Lupul’s contract on long-term injured reserve this season, Sportsnet has learned.

The decision comes after the 33-year-old winger underwent a second medical examination following his failed physical from team doctors before training camp.

Lupul initially appeared to challenge that diagnosis — “Haha failed physical? They cheat, everyone let’s them” he wrote on his Instagram account last month — before deleting the comment and issuing an apology.

“I responded earlier this week to some negative comments on Instagram,” he wrote. “It was an inappropriate response, and I deleted it, but I take full responsibility. It’s been extremely tough not being able to play over the past 1.5 years.”

Lupul elected not to seek out his own second opinion — as was his right under the collective bargaining agreement — but the NHL initiated one so that it could independently determine his status.

Tuesday’s ruling will be met with a sigh of relief by the Leafs, who now have the ability to spend well above the $75-million salary cap by placing both Nathan Horton ($5.3 million) and Lupul ($5.25 million) on LTIR once the season starts.

They would have been tight to the upper limit and left without much much flexibility to add salary in-season had the league deemed Lupul healthy.

He last played for the Leafs in February 2016, when the team announced he would be shut down for the remainder of that season following sports hernia surgery.

Lupul has endured a slew of injuries and ailments during his career, including major back surgery while a member of the Anaheim Ducks. He failed his medical with Leafs doctors before training camp last September and missed the entire season before failing another one last month.

Still, some rival teams have held doubts about Toronto’s intentions.

The NHL’s ruling comes on the heels of a similar case involving Chicago Blackhawks forward Marian Hossa — he’s been deemed eligible for LTIR because of a skin condition — and should essentially close the book on Lupul’s tenure in Toronto.

This is the final season of a $26.25-million, five-year extension he signed in January 2013.

Lupul will be an unrestricted free agent on July 1 and has expressed a desire to continue his career.