PHILADELPHIA — Josh Bailey picked a perfect time to break out of his scoring slump.

Bailey scored twice 1:23 apart in the third period, stopping a 12-game drought, and the New York Islanders beat the Philadelphia Flyers 4-2 on Saturday.

Nick Leddy and Brock Nelson also scored for New York, which had dropped two in a row and three of four overall. Robin Lehner made 22 stops.

The Islanders (43-25-7) moved within a point of idle Washington for first place in the Metropolitan Division.

"Sometimes results breed confidence," Bailey said. "Sometimes you feel like you're doing the right things, the other team gets a bounce and things can snowball for you. (Today) we got one back with Brock and we really found our game after that"

Nelson's first-period baseball swing, knocking the puck out of midair, was New York's first goal in 134 minutes, 27 seconds after a pair of embarrassing shutout losses that had coach Barry Trotz considering lineup changes.

"I thought about it and it was actually quite difficult," Trotz said. "We talked about it as a coaching staff because there are some guys I wasn't really happy with. ... But I felt it was important to go back with this group and sort of challenge them a little bit. I liked the response. I liked the response about stepping up to the plate here and getting it done. That says a lot about the group."

Robert Hagg and Shayne Gostisbehere scored for Philadelphia, and Carter Hart made 36 saves.

The Flyers (36-31-8) had won two of three, including a 3-1 victory at Chicago on Thursday night. But the home loss against New York is a big blow to their fleeting chances of rallying to the second wild card in the Eastern Conference.

"I'm sure it's weighing on the players, knowing how time is winding down here with seven games left," Flyers coach Scott Gordon said. "Obviously, we weren't in a position, never mind to have a losing streak, but to lose more than this one game. That's where we're at right now."

Gostisbehere tied it at 2 with a power-play goal 6:16 into the third, but the Islanders went ahead to stay on Bailey's scoring flurry.

First, Nelson won a board battle to get the puck to Bailey, who sprinted down the right wing and snapped a pretty shot past Hart for his 15th of the season. On his very next shift, Bailey took a pass from Leo Komorov and one-timed a shot past Hart to make it 4-2 at 17:26.

Hagg opened the scoring in the first period with a wacky goal. His shot was a good six feet wide of the net, but it took a strange carom off the end boards, hit Islanders forward Casey Cizakas in the leg, and then off the back of Lehner's glove and into the net.

But New York rebounded quickly. Following Nelson's 23rd goal, Leddy capped off a dominating shift by the Islanders with his fourth of the season on a slap shot from the high slot 10:58 into the second.

"Sometimes when you have a stretch like this everyone kind of tightens up a little bit," Lehner said. "We tried to do a little bit too much and kind of lost the fun of the game. I think today we just had the mindset go play our game, have fun again and enjoy the game."

UP NEXT

Islanders: Return home to host Arizona on Sunday.

Flyers: Visit Washington on Sunday.

___

More AP NHL: https://apnews.com/tag/NHL and https://twitter.com/AP_Sports