Hector Neris had thrown 13 pitches in the ninth inning of Thursday night’s 3-1 loss to the Marlins and came within inches of blowing the game when Gabe Kapler asked the reliever to give the Phillies three more outs.

Kapler said he knew then that what was best for Neris was to lift him after the ninth inning. Neris had pitched a scoreless ninth, but he had allowed two singles and the game only remained tied because the inning’s third out came on a terrific throw home by Nick Williams.

“Every step of the way, I considered saying ‘You did a good job and that’s enough,'” Kapler said.

Edubray Ramos was warmed in the bullpen. The tenth inning could have been his and “Ramos would’ve done a very nice job for us,” Kapler said. But Kapler went against what he thought was best for Neris and pushed the pitcher into the 10th inning.

He stayed with Neris when he allowed a two-out double to Neil Walker, a glaring alarm that trouble was near. Then it was too late. Starlin Castro lined Neris’ fastball for a two-run homer to left. Another difficult loss was sealed.

“The first thing I want to say is that I didn’t put Hector in the position to succeed right there,” Kapler said. “He’s been so good all year. I really wanted to lean on him. That’s on me. I trusted him and really wanted him to get through that second inning for us and felt really confident in him. But I knew what was best for Hector was to get him out after that first inning of work. That one is on me.”

The Phillies have lost six of their last eight games and looked Thursday like the team that limped through a seven-game road trip. Their offense mustered just four hits and one run against a woeful Marlins team. Aaron Nola allowed one run, but he had to be even better when the lineup provided such little support. And Neris had to get six outs, not five.

“I tried to attack him,” Neris said. “I think the fastball in that moment was the pitch to throw there because I don’t think anybody is waiting for that ball.”

J.T. Realmuto, Bryce Harper, Rhys Hoskins, and Maikel Franco -- the lineup’s No. 2 through 5 hitters -- combined to go 0 for 15. The Phillies had just five chances with runners on scoring position and their lone run came on a homer by Sean Rodriguez, a utility player who joined the team Wednesday in New York. The Phillies need much more from their lineup.

“There’s no question our lineup hasn’t been clicking like it can,” Kapler said. “We’ve been pretty beat up by injuries but that’s no excuse. We can perform better at the plate.”

Williams, who moved to left field after being used as a pinch hitter, kept the game tied in the ninth by throwing out Miguel Rojas at home. It was a perfect throw by Williams and a perfect block and tag by Realmuto. Williams, who has yet to start a game this season, was fielding a ball in a game for just the third time this year.

Nola pitched well, but he still did not look like the pitcher the Phillies expect him to be. Thursday night, at home against a woeful Marlins lineup, seemed to be the perfect night for Nola to pitch like Nola. But it failed to happen. He gave up seven hits, pitched with runners on base in almost every inning, and left with runners on first and third. Nola allowed just one run, but nothing seemed to come easy.

“I felt pretty good tonight. Felt good overall. My pitches felt pretty good," Nola said. "Hung a couple pitches, a couple curveballs that went for base hits. I gave up seven hits but I felt I bared down with guys in scoring position.”

The Marlins’ lone run off Nola came in the third inning off an RBI single by Martin Prado. He had spotty command of his fastball and a curveball that generated just three swings and misses. Nola, just like he did Saturday night in Denver, continued to trend in the right direction.

After allowing 15 runs in a 13 1/3-inning stretch over three starts, Nola has allowed four runs in his last two starts over a 12 1/3-inning stretch. He’s not back to where he was last season, but he’s better than the pitcher who struggled earlier this year.

“Really good sign for Nola,” Kapler said. “Steps in the right direction. Still not his best. Still not his best curveball. But certainly moving in the right direction and looking more and more like himself.”

Adam Morgan needed just five pitches to record the third out of the seventh inning when he relieved Nola. Seranthony Dominguez handled the eighth and Neris sneaked through the ninth before imploding in the 10th. He retired the first two batters of the inning before Walker doubled. That seemed to be a chance to lift him for Ramos, but Kapler chose to let Neris decide the game.

One batter later, it was decided. Williams, an inning after his game-saving throw, jogged to the wall as the homer sailed over his head. There was nothing he could do this time to bail out Neris as he watched another loss unfold.