NEW YORK — For the second straight possession in a game Maryland men’s basketball was quickly running out of chances to climb back into, guard Aaron Wiggins came down with a crucial offensive rebound.

Both times, the freshman threw the ball away, the latter ending with a Ayo Dosunmu lay-in at the other end to give Illinois a commanding lead with little over a minute to go.

After giving up 29 fastbreak points against No. 6 Michigan State on Monday — breaking what had been a seven-game winning streak that propelled the Terps to No. 13 in the country — coach Mark Turgeon’s squad once again struggled to stop a fast-paced team, and the glut of turnovers complicated matters.

Despite holding an 11-point lead midway through the first half, the Fighting Illini’s offense broke out for 27 points in transition, along with 27 points off 21 turnovers, to upset Maryland, 78-67, at Madison Square Garden.

“We just weren’t very good when we needed to be good,” Turgeon said. “And they were.”

What had been a comfortable first half evaporated as Dosunmu began to outrun Maryland’s defense. He scored seven points as part of a nine-point run at the end of the opening period, slimming the Terps’ halftime edge to four.

That spurt breathed new life into an Illini team (6-14, 2-7 Big Ten) that hasn’t found much success this year.

“Cutting that to four … gave us a locker room that was excited to go play the second half,” Illinois coach Brad Underwood said. “We got some easy baskets, Ayo got out in transition.”

Forward Bruno Fernando easily backed down Giorgi Bezhanishvili in the paint en route to 10 first-half points. But despite finishing with a team-high 19, Maryland couldn’t capitalize on the height advantage at the post, particularly after Illinois began utilizing help-side defense.

After a turnover from Fernando to open the second half, Illinois once more hit the gas. Adonis De La Rosa stood by the Illinois bench, waving his hand and calling for his team to pick up the pace. Then, Trent Frazier hit the Illini’s fourth three-pointer in a row to begin the second half, establishing their first lead over the Terps since the 18:52 mark of the first half.

“[Underwood] was telling us just come out in the second half and punch them in the mouth first,” Illini guard Tevian Jones said. “Make sure that we’re guarding and that we’re executing on offense.”

Jones followed a two-point first half with a 16-point second period, hitting one of his four three-pointers with about four minutes to go to give Illinois a 62-59 lead, shortly after Fernando missed the front end of a 1-and-1 and couldn’t convert a layup. Dosunmu finished with a game-high 20 points.

After Jones’ triple, Fernando hit a pair of free throws to pull within one. But Illinois didn’t allow the Terps any closer and closed the game on a 20-8 run, hyping up the Illini faithful that were outnumbered among the 7,239 fans inside Madison Square Garden.

“We just made key errors that we can’t, especially in a league like the Big Ten,” guard Anthony Cowan said. “Everybody is good. You just can’t make those errors.”

So for the second straight game — this time against a far less imposing opponent — Maryland didn’t seem to find the answers to slow down a quick transition offense. And with the loss, the Terps are left with none of the momentum it carried to East Lansing earlier this week.

“We had some bad turnovers,” Turgeon said. “We weren’t good with the ball.”