The Nationals have gotten back on track, but is it enough to overtake the Mets and win the division? (Post Sports Live/The Washington Post)

Among the many reasons the Washington Nationals find themselves in this situation — 6 1/2 games behind the first-place New York Mets in the National League East with 35 left to play and autumn peeking around the corner — Max Scherzer’s second-half slide is perhaps the most curious.

At the all-star break, Scherzer was among baseball’s elite pitchers. His production has slipped since, a flaw in his mechanics spotted recently as the cause. He has walked more batters and given up more home runs, and Friday the long ball came back to haunt him in a 4-3 loss to the Miami Marlins.

There was plenty of good in Scherzer’s start. He was aggressive, struck out eight and walked none. His velocity was normal, and his offspeed pitches were sharp. But Scherzer, the Nationals’ $210 million ace, gave up four runs on six hits, and his fastball command was off. Martin Prado hit one in the third inning for a two-run homer, and Marcell Ozuna connected with another in the fourth for a solo shot that proved to be the difference.

A late August defeat counts as much as an April loss, but it feels worse this time of year.

“They’re painful now,” Scherzer said. “There’s no doubt about that. You want to go there and compete and do everything you can to help the ballclub win. When you’re not able to do that, it’s frustrating.”

Matt Williams won NL Manager of the Year in 2014, but the Nationals fell short of playoff expectations last season and have underperformed this year. Is Williams in danger of losing his job if the team misses the postseason? (Post Sports Live/The Washington Post)

Scherzer’s first half helped the Nationals navigate myriad injuries with the power of his right arm. In his first 16 starts, he allowed three earned runs or more three times. But over his past 10 starts, Scherzer has given up at least that many seven times. Two weeks ago, Scherzer spotted the issue on video and began addressing it between starts.

“I’m not sitting here kicking chairs around because I’m frustrated with how I’ve pitched,” Scherzer said. “My stuff is there. It’s just that there’s a couple mistakes within my outing that I’ve got to shore up. I’ve got to keep that focus at 100 percent. Not saying I’m losing focus but to keep that dialed-in hungry feeling going. Because when you make little mistakes at this level, they make you pay.”

The Marlins scored a run in the first inning, but Ian Desmond’s solo home run in the second erased the deficit. Since the all-star break, Desmond has hit nine home runs. Only five players in the NL have more in that span.

Two innings later, Scherzer’s mistakes squandered the tie. Dee Gordon singled on a fastball, then Scherzer went back to the pitch on a 2-2 count to Prado. Scherzer put it on the inside part of the plate, and Prado turned on it, sending it over the left field wall for a 3-1 lead. Prado is 8 for 17 all time against Scherzer.

“I don’t think the pitch to Prado is a bad pitch,” Nationals Manager Matt Williams said. “It’s a good swing.”

The pitch to Ozuna was not a good pitch, a fastball that was up and over the plate that Ozuna drilled to straightaway center for a 4-1 lead. Scherzer settled in after that to retire his final 12 batters.

In his first 118 2/3 innings, Scherzer allowed only seven home runs. He has served up 13 over the past 591/3 innings. In that span, his ERA is 5.01 and the Nationals are 3-7.

“He’s strong, reaching back for 98 tonight,” Williams said. “I don’t think there’s an issue there. I know that he feels good. Location may be not as good as it was during that good streak that he had.”

The Nationals kept Friday’s game close thanks to the resurgence of Desmond and catcher Wilson Ramos. The catcher pulled the Nationals within two in the fifth inning with a towering solo home run over the visitor’s bullpen in left field. It was Ramos’s third home run in five games.

Apart from those blasts, the Nationals’ offense sputtered.

In the sixth, the Nationals loaded the bases thanks to a double by Jayson Werth, a single by Anthony Rendon and a walk by Bryce Harper off Marlins rookie left-hander Adam Conley. Ryan Zimmerman’s sacrifice fly off hard-throwing right-hander Kyle Barraclough trimmed the Nationals’ deficit to 4-3.

Desmond then struck out on four pitches, flailing at a two-strike slider low and outside. A walk by Danny Espinosa created another prime opportunity, loading the bases with two outs for Ramos. He drilled the ball up the middle, and Barraclough deflected it in the direction of second baseman Gordon, who threw to first to end the inning.

“Bad luck today with that,” Ramos said. “I hit the ball really well.”

The Nationals threatened again in the ninth inning against Marlins closer A.J. Ramos. Desmond singled to lead off the inning, and Espinosa moved him to second with a sacrifice bunt. Ramos struck out, and then pinch hitter Clint Robinson flied out to right to cap another loss.

“They don’t feel good,” Desmond said. “But we’ve got a pretty good attitude in here. We believe. That’s the first step. Now we just have to go out there and play good competitive baseball like we’ve been doing and just kind of hope for some big hits.”