Anthony Cowan stood at the edge of Maryland men’s basketball’s huddle with 30 seconds left Wednesday, wiping his sweat-drenched face with his jersey.

For the 35 minutes he was on the floor, Cowan battled alongside his teammates to narrow what had been a 17-point deficit against No. 4 Virginia to four points. But as time wound down in front of a sellout Xfinity Center crowd, Cowan fouled out of a game he had struggled in for the most part before a late surge.

On the Terps’ first possession, Cowan’s turnover began a trend that would nag at them throughout the contest. Often during the Terps’ undefeated start to the season, turnovers have been a lingering problem. Against weaker, early-season opponents, Maryland has weathered those giveaways with superior inside play.

But against a powerhouse team like Virginia, Maryland’s 14 turnovers — compared to its opponent’s two — dug a hole coach Mark Turgeon’s squad couldn’t find a way out of, eventually dooming the Terps to a 76-71 loss in the ACC/Big Ten Challenge.

“We fought,” Turgeon said. “It’s hard to come back on Virginia, and we were able to do it.”

After guard Eric Ayala hit a 3-pointer about four minutes in, the Terps didn’t knock down another shot from outside the rest of the opening frame. Twenty-seven of Maryland’s 30 first-half points were from inside the paint.

It showed Maryland’s reliance on Fernando, who wowed fans and NBA scouts in attendance with alley-oops and put-back dunks, as well as a dribble-drive to the basket, in the opening period. He notched 10 points by the end of the first half.

As Turgeon opted for a smaller lineup late to aid the comeback attempt, though, Fernando’s influence waned, the victim of frequent double teams on the post. He finished with 14 points and 11 rebounds, still reaching his third double-double this year.

“Bruno’s a monster,” Ayala said. “He’s fighting every game. I wouldn’t have any other big man in the country behind me.”

Meanwhile, the Cavaliers hit 8-of-16 shots from beyond the arc in the first 20 minutes, led by guard Kyle Guy’s four. Maryland (6-1) infiltrated Virginia’s pack-line defense with more effectiveness than most opponents do, with help from transition buckets.

But Turgeon’s side struggled to defend the perimeter at points early. And when the Terps did, Guy seemed to splash from deep regardless, ending with a game-high 18 points on 5-for-9 three-point shooting. Guard Ty Jerome finished with 17 points, adding three triples to his line.

“They’re better athletes than people give them credit for,” Virginia coach Tony Bennett said. “They’re not afraid of the moment.”

As the teams left the floor at halftime, one student on the sideline lifted a UMBC shirt, seemingly to remind the Cavaliers of their loss last March to the No.16-seed Retrievers in the NCAA tournament. But the difference between that upset and Wednesday’s loss in College Park was three-point shooting, which helped keep Virginia ahead.

UMBC shot 50 percent from range while the Cavaliers made 4-of-22 attempts. The roles were reversed Wednesday, with Maryland hitting one three in the first half and waiting 20 minutes before Ayala and guard Aaron Wiggins hit back-to-back triples about four minutes into the second half, drawing the game back within 11 points.

After four first-half points, Cowan finished with a team-high 15. He knifed through the Cavaliers’ defense to cap a 7-0 run with four minutes to go to put Maryland within four points. He cut the deficit back to five with 54 seconds left with five points on consecutive possessions.

“They run their offense like they were trying to … wear Anthony out. They kept circling the guy,” Turgeon said. “Anthony gave us everything he had. He was terrific.”

Maryland shot 54 percent and outrebounded Virginia by 12, showing positive signs for a vastly inexperienced team compared to Virginia (7-0). The Terps managed to score 71 against the Cavaliers, who had surrendered more than 70 points just one other time since the start of last season — when UMBC did it.

But turnovers and early outside shooting woes allowed the Cavaliers to mount a 17-point advantage early in the second half, complicating matters and leaving Cowan wiping his face and watching from the bench with 30 seconds ticking to a close.

“We have heart,” Fernando said. “We never quit and we try to play as hard as we can.”