Maryland quarterback Perry Hills was on his back for much of Saturday’s game against Connecticut. (Jonathan Newton/The Washington Post)

Through its first two games, the Maryland football team had exhibited a resilient streak that was absent through most of Coach Randy Edsall’s first season, a united front that brought the Terrapins within one win of their first 3-0 start since 2001.

But Maryland did not find the finishing touch on Saturday against Connecticut. Instead, the Terrapins ran out of time in a 24-21 loss at Byrd Stadium, which they exited with a sense of frustration after a number of missed opportunities.

“We had a chance to tie or win the ballgame at the end even with the mistakes and miscues that we had,” said Edsall, who was coaching against the team he led from 2000 to 2010. “That shows a lot about the character, perseverance and belief that these guys have in themselves and each other.”

The comeback that never came ended on a last-ditch, fourth-down deep ball that sailed out of the end zone. It was the culmination of a two-minute drill that Edsall said his team had struggled with in practice. Maryland (2-1) had taken over near midfield with 3 minutes 29 seconds left and down three points. Approaching field goal range, things instead went backward.

After a 10-yard pass to wide receiver Stefon Diggs gave Maryland a first down at the Connecticut 32, freshman quarterback Perry Hills lost three yards. Kevin Dorsey dropped a pass at the sideline, then lost four yards on a blown-up bubble screen.

On fourth and 17, Hills overthrew Kerry Boykins in the end zone, allowing the Huskies (2-1) to run out the clock.

Blitzed and battered by Connecticut’s pass rush all afternoon, Hills should have been permanently attached to ice after the game. Instead, the freshman quarterback sat ice-free in khaki shorts after being sacked six times.

“Left plays out there that could have been game-changers,” said Hills, who cut the Huskies’ lead to 24-21 with a 10-yard touchdown run with 4:39 left. “I don’t accept losing. I don’t like losing. But I promised my team that I’ll prepare like I’ve never prepared before to get ready for this next game.”

Connecticut brought the house, the farm and all other matters of residential structures on defense with a well-disguised pass rush designed by former Maryland defensive coordinator Don Brown.

Penalties and backfield stops stalled an offense that shined one week earlier in a victory over Temple.

Maryland had eight drives of three plays or less and as many plays that went for zero or negative yards. They finished with 205 yards.

“It’s maybe something we’ve never seen before, but there’s a lot that is going to happen this year that we’ve never seen before,” Diggs said. “It’s all about how you adjust and how you battle adversity.”

Diggs escaped Connecticut’s special teams coverage throughout the afternoon (he totaled 166 yards on eight kickoff and punt returns) with runs that included spins, hurdles and escape acts only missing a velvet cape and a puff of smoke. But he saved the greatest wizardry for his first career touchdown.

With Hills flushed out of the pocket on third and 10 just seconds into the fourth quarter, the freshman quarterback heaved a prayer toward the end zone. Tipped by Marcus Leak, Diggs came rushing across the field and snagged it for the 29-yard score that brought the Terrapins within 17-14.

“I love the kid,” Edsall said of Diggs. “I love how he comes to practices and how he competes. He always has high energy and is a real leader for us.”

But the 10-play, 76-yard Connecticut drive that followed, which was capped by an 11-yard touchdown run by Lyle McCombs, gave the Huskies an insurmountable lead. It was a rare defensive breakdown by a Terrapins defense that hadn’t allowed a drive of more than 70 yards until that point. The Huskies’ march included an 18-yard completion on third down, a 21-yard scramble by backup quarterback Scott McCummings and McCombs’s third touchdown of the season.

McCummings had a three-yard touchdown run early in the second quarter — minutes after Nick Williams scored on a 58-yard punt return — to put the Huskies up 14-0.

“All three phases of the game feel like they let the team down,” Maryland defensive lineman A.J. Francis said.

During his postgame remarks, Edsall became emotional when asked about greeting his former players at midfield after the game. His eyes watered. His voice cracked.

“It was good to see some of the guys and to wish them well,” Edsall said, thinking about the Huskies players he recruited and coached, and whose hands he shook on the Byrd Stadium turf before exiting to chants of “U-C-O-N-N” from the Connecticut faithful in attendance.