SALEM, Va. — Baseball can be cruel.

Riverside found that out in a 9-8 loss to Lafayette in the Virginia Class 4 state championship game Friday when what would have been a groundout to clinch the title turned into a throwing error that allowed two runners to cross the plate and gave the ­Williamsburg school the title.

“Everybody will be focused on that last play, but there’s many other things that happened in the game,” Riverside Coach Sam Plank said. “There were three, four or five runs that were uncharacteristic of us. They all mean the same.”

After the game, the players embraced their teammate. There were no words of anger or blame.

“These kids love each other and they understand that was the last play, but there’s a lot of other plays in the game,” Plank said. “It’s a seven-inning game, but you can’t focus on one play.”

The two Lafayette runners who scored reached base without ­getting a hit. Osvaldo Torres was hit by an 0-2 pitch to begin the inning. He stole second and third base. Riverside pitcher Jared Smith retired the next two batters but walked Michael Labella, who stole second. Smith got two strikes on the following batter, Tommy McLaughlin, who then hit the ball that ended the game.

Riverside was an out away from losing in the top of the seventh, but pinch hitter Ryan Murray belted an RBI triple off the left field wall to tie the score. He scored the go-ahead run on an RBI single by Sajon Belser.

“He flipped me a curveball down the middle, so I just did what my coaches taught me to do,” Murray said. “I’ve been pinch-hitting for a while and I’ve been fairly hot, so I went up confident.”

Smith pitched 3 ⅔ innings and allowed two runs, both unearned, in relief of Wyatt Shenkman.

Seven Rams had an RBI, led by Patrick Sheffield with two. Carson Swank and John Heltebran each had two hits, and Swank reached base four times.

After giving up seven runs in the first two innings, Riverside did not allow another run until the game’s final play.