Shawn Kelley allowed three runs and got only one out in the ninth as the Nationals failed to hold off the Phillies on Sunday in Game 1 of a doubleheader. (Katherine Frey/The Washington Post)

There could not have been two games to epitomize the 2017 Washington Nationals better than the pair that took place as part of a split doubleheader at Nationals Park on Sunday. In each, the Nationals’ bullpen collapsed attempting to protect a lead against the reeling Philadelphia Phillies, leaving the offense, atop the National League in nearly every significant offensive category, again to slug out of a late deficit to salvage a victory.

The problematic formula backfired in the first game, a 4-3 loss, but Washington managed to overcome another bullpen fiasco in the second with Michael A. Taylor’s two-run home run in the eighth inning of a 6-5 victory. It was a mind-numbing twist of emotions, but the Nationals emerged from the 18-inning rumble still boasting the best record in the National League at 24-13 after Matt Albers, their most reliable reliever, produced the perfect ninth inning they often so desperately seek.

“No drama,” Nationals Manager Dusty Baker said. “We like that. The manager loves that.”

The Nationals’ first bullpen meltdown began with a 400-foot home run. Shawn Kelley threw the pitch, a full-count fastball, and Aaron Altherr whacked it because it was right down the middle. The solo blast — the 21st Washington’s bullpen has surrendered this season — trimmed the Nationals’ lead to one, and it didn’t end there.

Two batters later, Maikel Franco rocketed a double off the wall in center field — just inches short of a game-tying home run. Cameron Rupp followed with his own missile to center for a double to tie the game. The three hits came on fastballs because Kelley, who threw 25 pitches in his return from the disabled list Saturday night, said he quickly recognized he couldn’t rely on his slider. That left him with one pitch. The middle of the Phillies’ lineup pounced.

“Felt like they were able to sit on fastballs,” said Kelley, who has allowed six home runs in 11⅓ innings . “And I took my best shot trying to just go at them and attack them with the heater because I realize that’s pretty much all I had today. It didn’t work.”

Kelley then walked Freddy Galvis, which coaxed Baker out of the dugout to replace him. Kelley walked off to boos as Koda Glover, the Nationals’ other co-closer who also came off the DL on Friday, entered to make his second appearance in less than 24 hours. He also couldn’t get the first batter out and surrendered a go-ahead single to the light-hitting Ty Kelly.

As a result, the Nationals entered the nightcap knowing Kelley and Glover weren’t available but with the ideal weapon to conceal the diminution: Max Scherzer. Scherzer played his part for three scoreless innings, discarding the Phillies (14-21) with 51 pitches. Then a liner threatened to ruin his night — and beyond.

Scherzer’s 57th pitch was a 93-mph fastball to Michael Saunders, and Saunders cracked a 100-mph line drive right back at him that drilled the inside of his left knee. Scherzer tumbled to the ground instantaneously, got up, then dropped again squirming in agony. The unsettling sight cast a pall over the ballpark, and the usual three-man unit of Baker, pitching coach Mike Maddux and head trainer Paul Lessard bolted out to check on him.

“I thought he got shot,” Bryce Harper said.

Lessard massaged the ace’s aching knee as he lay on his back on the infield grass and chants of “Let’s go Scherzer!” resonated. Scherzer needed a couple minutes before standing up. He talked to the trio and took to the mound to toss warmup pitches, intent on staying in the game. He threw three and declared himself ready. The trio trusted him, and he stayed in.

“I just needed to catch my breath and let everything kind of relax,” said Scherzer, who was already dealing with a blister. “Once everything relaxed, I was able to stand up. I could really put my weight on it. I got on the mound and really tested my warmup pitches to make sure I could really get into that knee. Fortunately, it hit the inside part of that knee, and somehow, some way, that didn’t affect how I landed.”

He then needed just one pitch to get Andres Blanco to fly out and sprinted behind third base to back up a throw as Altherr advanced to third, a sign that the knee was fine or adrenaline was serving as a great masking agent. Scherzer then allowed two hits that produced two runs, but he proved he was just fine by posting his first immaculate inning — striking out the side on nine pitches — and the second in Nationals history in the fifth.

Trea Turner’s sacrifice fly and an RBI double from Harper, who homered in the first game and had three hits in the second, gave the Nationals a 3-2 cushion. Scherzer promptly squandered the lead by surrendering consecutive hits to start the sixth, but he escaped without further damage thanks to a heady play by Turner. The shortstop, shaded up the middle as part of a shift, made a diving stop on a groundball off Daniel Nava’s bat. Recognizing he didn’t have a play at first base, he immediately threw to Anthony Rendon at third, where Brock Stassi was aggressively rounding the bag. Stassi had no choice but to dash for home, and Rendon’s throw beat him for the third out. The play incited a fist pump from Scherzer, whose outing ended at that point after he allowed three runs over six innings. He threw 105 pitches — 48 following the comebacker — and said he felt “great” afterward.

Brian Goodwin’s pinch-hit double in the sixth put Washington back on top. From there, the Nationals’ relief corps stumbled again when Jacob Turner, a non-roster invite who has been a revelation out of the bullpen, yielded a two-run triple in the eighth inning to relinquish the lead. But Taylor salvaged the second game for the Nationals, and Albers notched his second career save — and second in 10 days.

Taylor’s heroics couldn’t hide the disconcerting reality for the Nationals’ bullpen. The thinking among the Nationals’ brass is that the bullpen’s failures over the first six weeks of the season are irrefutable but not irreversible. Last week, General Manager Mike Rizzo said he believed a couple of relievers were the victims of bad luck and that the returns of Kelley and Glover would bolster the unit. It’s mid-May — too early for a trade of consequence anyhow — and they enjoy a commanding lead in the National League East. There’s time for further evaluation and for the necessary moves to make the group postseason worthy.

That logic is sound. Maybe the Nationals will continue playing .649 ball without their best relievers meeting expectations and it won’t matter in a weak division. But the bullpen remains a problem, and it nearly cost the Nationals twice in one day.

“On the real good teams that I’ve had, when you get to the sixth or seventh inning, we know it and they know that the game is over,” Baker said. “And so we just got to go back to the drawing board to try to figure it out.”