Nationals starter Livan Hernandez takes off after dropping down a sacrifice bunt in the second inning. On the mound, Hernandez lasts just four innings before taking the loss to fall to 5-10. (Jonathan Newton/The Washington Post)

The top step of the Washington Nationals’ dugout filled late Wednesday night, brimming with players and the sudden possibility of a miracle. The players watched as the ball rocketed off Laynce Nix’s bat, carrying with it the chance to prevent the kind of losing streak that had recently become foreign to them. They had already scored four runs in the ninth inning. If the ball kept carrying, two more would tie a game that had seemed lost long before.

When it settled on the warning track, just inside the fence, the players doubled over and started removing their things from the dugout. The Nationals’ rally revived a slumping offense, but it could not prevent a 7-5 loss to the Florida Marlins before 21,974 at Nationals Park, their fourth straight defeat. The Nationals, mired in their longest losing streak since late May, will wake up Thursday morning in last place, and no matter what happens that afternoon they’ll wake up in last place Friday morning, too.

Their performance has separated this year from their past — the Nationals would have to finish 20-39 to fall to last season’s record. But their place in the standings, thanks in part to playing in the National League East, has not. The Nationals are 14-23 against division opponents, who combine for the best total record of any division.

“I think we’re frustrated,” closer Drew Storen said. “But I think we’re also battling. It would have been easy for us to roll over and feel bad for ourselves and go home. But we’re battling, and we’re going to go out there every day and play hard, and we’re going to turn this thing around.”

Storen had a particularly disappointing night. He entered in the ninth with the Nationals down 5-1, a non-save situation because he needed the work. He recorded two quick outs, including a strikeout, then gave up a soft single to Mike Stanton. He then threw a 3-1 fastball to Mike Cameron, who launched his second homer of the night over the left field fence.

“It’s just one pitch,” Storen said. “You get a broken-bat hit, and you get one pitch up in the zone. They capitalized on it. Everything else was good. Everything else was sharp. It was just one pitch, but that’s what happens when you pitch late in the game.”

The blast put the Nationals in a 7-1 hole, but their offense would soon give the deficit more than cosmetic meaning. Counting the first eight innings, the Nationals had produced four runs and 11 hits over three games. Manager Davey Johnson had rested four starters — Jayson Werth, Ian Desmond, Wilson Ramos and Roger Bernadina — in hopes of igniting something.

It didn’t work until the ninth. Against Marlins reliever Steve Cishek, Desmond came off the bench and led off with a triple to the right field corner. The Nationals kept rallying when Ryan Zimmerman’s ground-rule double scored a run, put two runners in scoring position and sliced the lead to 7-3. The Marlins brought in closer Leo Nunez, but Michael Morse followed with a two-RBI single.

Suddenly, the Nationals had brought the tying run to the plate. Nix had delivered the Nationals’ first run with a mammoth homer into the second deck in right field in the fourth inning. In the ninth, he took another wicked hack at a first-pitch change-up by Nunez. The ball screamed off the end of his bat toward right.

“I didn’t quite get it all,” Nix said. “I was just waiting for it to go. But it stayed short.”

Livan Hernandez lasted only four innings, allowing four runs on five hits and three walks. He had no feel for his sinker, he said, and that caused his pitch count to soar to 87. His start also continued a small trend. The Nationals’ rotation overachieved and carried the team for much of the season. During the losing streak, though, Nationals starters have allowed 18 earned runs in 192 / 3 innings.

“Our pitching has kind of held us afloat all year,” Zimmerman said. “No one’s pitching is going to be consistent all year. They’ve done great. They’re walking more people than they did before. They know. Everyone knows. They’ve been the most consistent thing on this team all year. They’ve given us a chance to win every game. To go after them or attack them is ridiculous. They’ll get out of it.”

Hernandez is known as a workhorse, and he ended his night far earlier than usual. In the fifth inning, on his 87th pitch, Hernandez allowed a groundball single to Omar Infante that put runners on first and third with no outs. He had allowed three runs on three walks and five hits, including a homer to Stanton, shaky but not disastrous.

Johnson, though, opted for the bullpen, trudging to the mound and calling for long reliever Ross Detwiler. Hernandez gave Johnson the ball and looked up at the scoreboard. He took deliberate, small strides off the field. If Hernandez had walked any slower, he would have just been standing there.

“I can’t do nothing about it,” Hernandez said. “It’s the manager’s decision. I know I can continue pitching. I only gave up three runs. But it’s his decision, and I can’t do nothing about it.

“I don’t pitch good today. I don’t give a chance to win for the team. It’s frustrating right now.”