Washington Nationals right fielder Bryce Harper seemed unlikely to play Saturday. He had strained his left hamstring two days earlier on an ominous-looking slip in the outfield that looked like it might cost him months, but certainly more than a day.

But around 9 Saturday morning, Harper texted Manager Matt Williams to tell him he could play. Nine hours later, he was part of history, driving in two runs in support of the Nationals’ other superstar as Max Scherzer pitched the second no-hitter in team history.

When Harper’s name appeared on the lineup card, reporters prodded him about risking his long-term health. “I’m in the lineup,” is all he would say, repeating that response again and again.

He provided a more thorough answer in the bottom of the fourth inning when he came to bat against Pittsburgh’s Francisco Liriano. The left-hander had allowed one home run to a lefty since June 10, 2014, but hung a 1-1 slider. Harper drove it out to dead center field, into the grass beyond where the left-center and right-center field walls meet at a point.

As the ball traveled 436 feet, Harper took his time exiting the batter’s box and then jogged lightly to first, which likely had little to do with his sore leg, keeping two eyes on the ball until it landed. At that point, he made his 23rd home run trot of the season, a career high. Two innings later, he singled through the left side in the midst of a four-run rally. He drove in two of the six runs that supported Scherzer’s gem.

“His knee’s all bruised up, his hammy’s tight, and he’s up there competing, battling through injuries obviously, but he’s hurt,” Scherzer said. “He can play through pain. That shows you how much of a competitor he is. I respect that a tremendous amount.”

Of Harper’s 23 home runs this season, 10 have come in Scherzer’s 14 starts. Harper said seeing a pitcher work the way Scherzer does “gets you locked in even more.”

“I told him when we came in, ‘You keep pitching like that, I’ll keep hitting homers,’ ” Harper said. “It’s a lot of fun.”

Harper played in pain Saturday because his left leg is beaten up. He was hit with a pitch in the left quad last weekend in Milwaukee. The deep bruise that followed forced him out of Sunday’s series finale, then to serve as designated hitter on Tropicana’s Field artificial turf Monday in St. Petersburg, Fla., against the Rays. He tested the knee lightly Friday with weight lifting and mobility exercises, but the Nationals still watched him cautiously in batting practice Saturday to see if he could play.

He did, and was tested immediately. The second batter of the game, Pirates left fielder Starling Marte, drove a fly ball to deep right. Harper had to chase and leap but made the catch in front of the out-of-town scoreboard. From then on, through two more putouts and two hits in four at-bats, he looked fine.

“I just wanted to be in the lineup,” Harper said. “If that’s me being sore, me being hurt, this team needs me. I’m gonna cowboy up every single day I can play. If I can’t go that day, I’ll let them know. If I can, that’s what I’m gonna do.”

Harper was not on the field when Jordan Zimmermann completed his no-hitter last year, relieved of his duties early on the last day of the regular season. Banged up though he was, he did not miss this one.