After building a 27-point third-quarter lead Saturday, Maryland finished off one of the worst seasons in school history with an appropriate final chapter, one that will be cursed by Terrapins fans for some time.

An assortment of defensive lapses, turnovers and penalties caused Maryland to unravel with remarkable efficiency during the game’s final 21 minutes, allowing North Carolina State to score 42 unanswered points in that short window. As a result, the Wolfpack posted the second-biggest comeback ever in an ACC game and ran away with a 56-41 win before an announced crowd of 55,323 at Carter-Finley Stadium.

Maryland (2-10, 1-7 ACC) finished the season by losing seven straight games by double digits for the first time in school history. Coach Randy Edsall led Maryland to seven fewer victories than the Terrapins had in 2010. That matches the second-largest decline by a first-year coach of a major-conference program in the past half-century.

“It’s a disappointing loss,” Edsall said. “I thought our young men played hard until the very end, and we just were not able to duplicate what we did in the first half in the second half. . . . After the first series of the second half, we just could not make anything happen on either side of the ball.”

After the Wolfpack (7-5, 4-4) committed four first-half turnovers — including three fumbles in their first 11 plays — many fans booed the team off the field at halftime while scores of others headed for the exits. By game’s end, many of the departed appeared to be back in their seats to cheer the Wolfpack, who became the fourth team this season to become bowl-eligible against the Terrapins.

A matchup between the ACC’s most erratic team and the league’s weakest team could have produced a game that was neither aesthetically pleasing nor well played. The game, which produced 97 points, nine turnovers and three defensive touchdowns, instead was entertaining and dizzying.

As Maryland built a three-touchdown first-half lead, one bowl game official in the press box shook his head and said, “Can you believe this?” As N.C. State responded with 35 points in the fourth quarter, the same official shook his head and said, “Can you believe this?”

After the most crushing defeat in a season filled with them, the few Maryland players that were made available to reporters afterward appeared devastated.

When asked if he had ever experienced such a swing in such a short amount of time, Maryland quarterback C.J. Brown offered a wry smile and said: “No, I have not. You see them on TV, but, you know, this one hurts. This one hurts big time.”

Linebacker Demetrius Hartsfield said: “Definitely probably one of the worst feelings I have ever had as an athlete. Definitely one of the worst.

And defensive lineman Joe Vellano waited for reporters as he held and studied the statistical box score for several minutes, as if trying to make sense of all 96 offensive plays by the Wolfpack.

“Craziness, really,” he said of the game.

Vellano allowed himself to look at the scoreboard in the fourth quarter. In what seemed like a blink of an eye, Maryland went from routing the Wolfpack to getting routed.

“It was kind of a waterfall,” Vellano said of the 42 unanswered points.

Edsall did not reveal any particular emotion afterward except disappointment in the result. He praised the effort of his players. He said he was disappointed for Maryland’s seniors. And he said, in part because of the emotion of the game and the season’s endpoint, he would not comment on any potential staff changes until evaluating the season in the coming weeks.

The reasons for the collapse were clear. N.C. State converted 16 of 22 opportunities on third or fourth downs. It was 7 for 7 in red-zone scoring opportunities. And the Wolfpack got more push, Edsall said, on both sides of the ball in the second half.

“All of the sudden, we could not make a play,” Edsall said.

Maryland took a 41-14 lead with 10 minutes 41 seconds left to play in the third quarter. But Maryland’s last six possessions of the game ended with three punts, two interceptions (one returned for a touchdown) and one fumble. The Wolfpack’s final five offensive possessions ended with touchdowns.

Not considering punts, only four of Maryland’s final 23 plays after it took the 27-point lead resulted in gains of more than five yards. There was also a fourth-quarter lost fumble by senior running back Davin Meggett, who rarely fumbled in his career. There was a third-down pass interference call on cornerback Trenton Hughes to keep a third-quarter scoring drive alive.

And, after N.C. State had taken a 42-41 lead with James Washington’s one-yard touchdown run with 7:08 to play, Hughes was called for a roughing-the-passer penalty on a third-down play when the Wolfpack was attempting to bleed the clock in the final four minutes.

While Saturday marked a dark day for the Terrapins, two individuals with Maryland ties had memorable Saturdays. N.C. State players awarded the game ball to Athletic Director Debbie Yow, who spent 16 years at Maryland before leaving in 2010.

And some 90 miles west of Raleigh, James Franklin, the former Maryland offensive coordinator and head coach-in-waiting, led Vanderbilt to bowl eligibility in his first season as head coach with a 41-7 rout of Wake Forest (a team that defeated Maryland, 31-10, last weekend).

Edsall, meantime, helped Maryland accomplish a dubious distinction: The Terrapins became the first major-conference team in college football history to sandwich two 10-loss seasons around a winning season.

“It was really tough,” Edsall said of the game. “We needed to make the plays that we didn’t make.”