Washington Nationals relief pitcher Mark Melancon reacts at the end of a baseball game against the Miami Marlins, Saturday, Oct. 1, 2016, in Washington. The Nationals won 2-1. (AP Photo/Nick Wass) (Nick Wass/AP)

Over the past week, since clinching the National League East title, the Washington Nationals have navigated the final slice of their regular season schedule trying to strike a delicate balance.

They were playing for home-field advantage in the National League Divisional Series and recognized it was a luxury, especially in a best-of-five matchup against a cross-country opponent like the Los Angeles Dodgers. But they decided risking injury to key players was not worth the cost of improving their chances, so they shut down Daniel Murphy because of a strained buttocks and made sure Bryce Harper’s left thumb was 100 percent before he returned Friday from a four-game absence.

The caution continued Saturday before the Nationals’ 2-1 win over the Miami Marlins. Manager Dusty Baker decided not to put left fielder Jayson Werth in his lineup for the regular season’s penultimate game as a precaution with the magic number to clinch home-field advantage down to one. Werth left Friday’s loss with tightness in his back and side, but insisted he was fine.

It did not matter. The announcement was made to a roar during the seventh inning at Nationals Park: the Dodgers lost to the San Francisco Giants, 3-0, sealing home-field advantage for the home team. Game 1 will be Friday in Washington, with an expected pitching matchup of Clayton Kershaw vs. Max Scherzer.

“It’s not necessary but I’d rather have it here than to travel out there,” Baker said. “And you don’t know how things will work out after this and hopefully we’ll keep that home field advantage.”

Before the Giants helped out from the West Coast — boosting their own postseason hopes in the process — and rendered the result at Nationals Park meaningless, Tanner Roark completed his regular season with a short outing by his lofty standards, yet still effective. The right-hander exited with two outs and a runner at first base in the sixth inning to his chagrin, having allowed one run on three hits on 109 pitches to the Marlins (79-81). Blake Treinen relieved and struck out Jeff Mathis to end the inning.

The Nationals (94-67) used three more relievers for the final three innings to lock down the win. The bullpen combined to allow one hit and issue one walk over 3⅓ innings. Mark Melancon secured the victory with a four-out save, his 46th.

Roark concludes the regular season 16-10 with a 2.83 ERA in 210 innings — all career bests — one year after he was demoted to the bullpen despite an impressive 15-win campaign in 2014. He allowed two or fewer runs across at least seven innings in 16 of his 33 starts. Next up, most likely, is Game 2 of the NLDS next Saturday opposite Dodgers left-hander Rich Hill, eight months removed from competing for a spot in the starting rotation with Bronson Arroyo during spring training.

“It feels good that I’m still able go out there and compete,” Roark said. “Like last year and having the 15-win season in ’14 was a big confidence builder and mentally, too, was a big mental part of my career. And it taught me that I don’t have to throw the ball by everybody. And just go back to your roots and locate the ball and make them feel uncomfortable at the plate.”

Trea Turner and Bryce Harper gave Roark a lead immediately against Marlins left-hander Wei-Yin Chen. Turner led the first inning off with a single to center field. Two batters later, Harper smashed a line-drive single up the middle to score him. It was Harper’s first hit since returning from his thumb injury. He went 0 for 4 with four strikeouts Friday.

“It’s encouraging to the fact that he didn’t have a very good day yesterday and like I said he had to get the rust off,” Baker said. “And it was against a left-hander and that’s who he’s gone see the first two games of this series is left-handers.”

Danny Espinosa went 2 for 3 to snap his 0-for-20 slump, but Turner provided the eventual difference in the fifth inning with a home run to left. It was his 13th home run in 72 games. Turner, who is the first player in franchise history with 100-plus hits in fewer than 100 games played, also executed a delayed steal of second base in the eighth inning for his 32nd steal.

“Being a fast guy, everyone’s worried about you stealing, and when you don’t steal, they kind of let their guard down a little bit,” Turner said. “It’s a weapon that I need to use every once in a while.”

Turner was left stranded at second base, but home-field advantage was already clinched by then. It is an edge the Nationals will gladly take. The luxury didn’t help in 2012 or in 2014, when the Nationals stormed into each postseason with the best record in the National League, only to exit after the NLDS. This time, they’re not the top club in the league. Perhaps their fortunes will be different, too.