It’s not complicated, really, to explain the Islanders’ rapid defensive transformation from NHL-worst to stingiest in the league. But their improvement has exceeded any expectation that president and general manager Lou Lamoriello and coach Barry Trotz created by proclaiming that this would be a relatively easy fix.

X’s and O’s play a part, for sure, as opponents find little ice space in which to operate. In simple terms, the Islanders play in tight formation near their crease, keeping opponents to the outside and limiting cross-ice passes and rebound chances. That foundation has put them in strong position to make the playoffs for the first time since 2016.

But if it were that easy, Doug Weight still might be coaching them.

No, the master stroke from Trotz and his staff was getting these Islanders — 17 players are back from last season’s defensive wreck — to immediately buy into the attention to detail needed for the new mindset.

“My observation of them last year was they created a lot offensively, but it just seemed like they left [goalies] Jaroslav Halak or Thomas Greiss out to dry a lot of times,” said an NHL scout who requested anonymity. “The word was it was a pretty relaxed atmosphere in the room and in practice and there wasn’t much focus on the defensive side of play, and it showed.

“Barry Trotz, with how he coaches with the details and emphasizes defensive play, it clearly shows in the results now,” the scout added. “It’s a matter of details defensively and holding players accountable and making sure they know their responsibilities.”

The Islanders have allowed a league-low 132 goals in 54 games, putting them on pace to give up 200 in 82 games. Last season, they gave up 293 goals, the most in the NHL since 2007.

Subscribe to Sports Now newsletter By clicking Sign up, you agree to our privacy policy.

In five-on-five play, entering Saturday, the Islanders were seventh in the league with 23.7 shots allowed per game, according to NaturalStatTrick.com, after ranking 30th last season at 27.8. They also were leading the league in giving up 1.5 goals per game in five-on-five play after finishing 30th last season at 2.3.

“It just tells you their top guys take a lot of pride in playing both ends of the ice,” said the Kings’ Drew Doughty, who won the Norris Trophy in 2016 as the NHL’s top defenseman. “They’re not just cheating for offense. They’re looking to play good defense and then create offense when they get down there.”

“If you look at their defense corps, they have the guys,” Devils coach John Hynes added, citing defensemen Johnny Boychuk, Scott Mayfield, Nick Leddy and Ryan Pulock, in particular, plus the offseason acquisitions of forwards Valtteri Filppula, Leo Komarov and Matt Martin. “They’re big. They’re physical. They can skate. If you’re Lou and Barry and you come in and ask, ‘Can we be better defensively? Do we have the horses to be able to do it?’ They had the horses. Then you come into the buy-in and the enforcement of the commitment to defend.”

To fully understand the defensive system Trotz is using with the Islanders and, before that, with the Capitals and Predators, draw an imaginary line from the goal crease to the right faceoff dot, across the hashmarks to the opposite dot and then back to the crease to create a triangular “home plate.”

All five defenders are supposed to have their skates in that area, the defensemen low by the crease, the wings up near the faceoff circles and the center active in pursuing the play, going either side to side or coming up high.

Now draw an imaginary line down the center of the rink, from crease to crease. The defensive concept is to not let opponents pass the puck from one side of the line to the other. This is the “Royal Road” championed by former Islanders goalie Stephen Valiquette, now an analyst for MSG Network as well as the founder of Clear Sight Analytics. One of Valiquette’s analytical insights is that the puck crossing the “Royal Road” immediately preceding a shot increases the shooter’s scoring opportunity by more than 10 times.

The Islanders also have become much more adept at defensive-zone rotations. For instance, when the center pursues the puck into a corner, one of the wings will take over his defensive spot, rather than using the more static alignment from last season.

“They protect the inside of the ice really well,” said defenseman Dan Girardi, whose Lightning lost Games 6 and 7 of the Eastern Conference finals to Trotz’s Capitals by an aggregate 7-0. “They’re making you shoot it through three guys or make a few plays and hopefully open them up. But they’re not giving up a lot.”

The Islanders are getting solid goaltending from Robin Lehner (16-8-4, 2.02 goals-against average, .932 save percentage entering Saturday) and Greiss (15-8-2, 2.33, .926 entering Saturday). But it goes hand-in-hand. The goalies are prospering behind the improved defensive play.

Greiss explained it this way: Last season, he would need to make four or five reads on the opponent’s different options as they rushed up the ice. This season, he needs to make only one or two reads on a particular play.

“As a goalie, it makes a world of difference,” said former Islanders netminder Marty Biron, an analyst for the NHL and MSG Networks. “I don’t see the Islanders circling as much as other teams do. Some teams, their defensemen chase all the way to the blue line. Early in the shift, when there’s more energy, they may be jumping pucks and covering your man. But after 10, 15 seconds, it’s a zone [defense] and ‘let’s defend the middle of the zone.’ ”

But the defensive improvement is not limited to the Islanders’ zone. They also have become stingier in the neutral zone and more assertive with their forecheck.

“In the neutral zone, they do the 2-3 and they send both their wingers and then kind of lock on to their guys,” Kings left wing Carl Hagelin added. “They play pretty tight so you don’t have a lot of room. That’s what they’re really good at.”

Kings interim coach Willie Desjardins said Trotz’s ability to consistently roll four lines — Trotz rarely looks to match lines, instead trusting that all can handle whatever defensive assignment is required — also is beneficial.

“When you have less minutes, it makes you a little fresher on the ice, so I think it helps at both ends of the rink,” Desjardins said. “You get back into your structure quicker.”

It’s a similar turnaround to the one Trotz — who led the Capitals to the Stanley Cup last season — engineered in his first season in Washington in 2014-15. The Caps were eighth in the NHL in allowing 21.7 shots per game five-on-five and 11th in giving up 1.6 goals per game five-on-five after their respective numbers the previous season were 24.8 (25th in the NHL) and 1.9 (21st).

In both spots, Trotz found players frustrated with a lack of success and eager for direction.

The Islanders’ players also were motivated by doom-and-gloom predictions about life after former captain John Tavares left for the Maple Leafs via free agency.

“I saw a hungry group of young men,” Trotz said. “I had a group focused on trying to rectify some of the things that went on in the summer. You lose a guy like John Tavares, a lot of people put doubt on the New York Islanders. The players recognized we’re going to be OK. You don’t win with one player.”

Now the Islanders win with defense. It’s not that complicated, really.