The Terrapins softball team led Massachusetts by four runs heading into the sixth inning of its first game of the Maryland Invitational.

But a late collapse turned a comfortable advantage into a 5-4 defeat. And the Terps lost again, 10-1, later in the evening to North Dakota State to complete a disappointing return home. Before Friday, they played 24 consecutive road games to start the season.

Pitcher Hannah Dewey was dealing in the pitching circle until the sixth inning, allowing just three hits and no runs in the first five frames. But in the sixth, she lost control of her pitches and walked consecutive batters, one with the bases loaded, to allow Massachusetts (6-14) to cut the score to 4-2.

Then in the seventh, Massachusetts capitalized on poor defense from the Terps to take a 5-4 lead. Outfielders Sarah Calta and Destiney Henderson made errors that led to runs, and with one out and a runner on third, infielder Taylor Carbone hit a go-ahead sacrifice fly.

The Terps (7-19) had four hits and three walks in the loss. Dewey hit a single to knock in her team-leading 21st RBI of the season, and outfielder Kylie Datil added an RBI triple in the fourth, but it wasn’t enough.

Pitcher Brenna Nation started in the loss to North Dakota State (16-11). She surrendered two runs on three hits in the first inning, and one frame later, allowed two more to score on an RBI single and sacrifice fly.

The Terps offense couldn’t respond to the early deficit. They didn’t record their first hit until fourth inning when they managed to load the bases with two outs, though they didn’t score.

The Bison, meanwhile, scored twice more in the fifth and sixth to push the lead to 10-1.

Saturday, the Terps host Boston, which they beat 3-2 in the FAU tournament, and Ball State as they look to end a four-game losing streak.