COLLEGE PARK, Md. (AP) Harrison Barnes limped up and down the court on a sprained ankle, and starters Tyler Zeller and Kendall Marshall were on the bench with four fouls apiece.
Throw in the fact that the sellout crowd at Maryland was making it difficult to concentrate, and it's safe to say the conditions weren't exactly ideal for No. 5 North Carolina's biggest comeback of the season.
The Tar Heels persevered, rallying from a nine-point deficit in the second half to pull out an 83-74 victory Saturday.
''It's big for us. I think it showed character,'' said Marshall, who set a Comcast Center record by matching a career high with 16 assists. ''We were able to regroup and find a way to get it done.''
Zeller scored 22, and John Henson had 17 points and 12 rebounds to help North Carolina earn its fifth straight win and remain tied for first place in the Atlantic Coast Conference.
''I think this will help us a lot,'' Zeller said. ''It shows we can be tough enough in the end to be able to make the plays and get the stops we needed.''
The Tar Heels (20-3, 7-1) got all they could handle from the upstart Terrapins, who didn't lead over the final nine minutes but never let North Carolina get comfortable down the stretch.
Barnes, who injured his left ankle Tuesday against Wake Forest, hurt it again Saturday, coach Roy Williams said.
''I didn't tell him, but I said to myself if I saw him limping around again on the defensive end I was going to take him out,'' Williams said. ''Maybe he picked up on my vibe because he stopped limping.''
Barnes finished with 18 points on 5-for-15 shooting.
Henson scored 12 points over the final 10:12. His basket on a goaltending call against Alex Len with 2:04 left put the Tar Heels up 74-69, and a jumper by Barnes made it 76-70 with 1:02 remaining.
''We made some great plays down the stretch but we came up short again from getting that signature win, especially at home, which would have been a huge win for us,'' said Terps senior guard Sean Mosley, who scored 11 and now has 999 points in his career.
Terrell Stoglin scored 20 for Maryland (13-9, 3-5), but he missed 13 of 21 shots and was 1 for 9 from beyond the arc.
''It's real frustrating, but we're a young team and have to learn from it,'' said Stoglin, a sophomore.
It marked the first time that Terrapins coach Mark Turgeon faced Williams, his former mentor at Kansas. Turgeon nearly guided his team to a sensational upset. Instead, he had to settle for an encouraging showing because the Terrapins made only one field goal over the final three minutes.
''I thought their best players stepped up when the game was on the line, and they made all the plays,'' Turgeon said. ''(But) we're going to be good, soon.''
Maryland opened the second half with an 8-2 run - four points apiece by Mosley and Stoglin - to take a 48-39 lead. That meant North Carolina would have to mount its biggest rally of the season to win, topping the comeback from an eight-point deficit at Virginia Tech.
The Tar Heels wasted no time getting to it. A layup by Zeller and a 3-pointer by Marshall sparked an 11-2 run that tied it at 50 with 12:40 left. Minutes later, however, Zeller picked up his fourth foul and had to hit the bench.
''When Zeller was out I thought we could make a run,'' Turgeon said.
It didn't harm North Carolina. The Terrapins led 57-52 before Barnes sandwiched a 15-foot jumper and a 3-pointer around a dunk by Henson to put the Tar Heels in front.
Zeller scored 14 points in the first half, but Maryland committed only four turnovers in taking a 40-37 lead - only the fourth time this season the Tar Heels trailed at halftime.
''The first half, I thought (the Terrapins) were much more aggressive than we were,'' Williams said. ''We looked tentative around the basket.''
North Carolina got only two first-half points from its bench - a basket by James Michael McAdoo.
The Tar Heels temporarily blunted the enthusiasm of the crowd by moving ahead 15-9 before Nick Faust scored five points in an 8-0 run that put the Terrapins in front. Barnes ended the surge with an alley-oop dunk, then drilled a 3-pointer to put the Tar Heels up 20-19.
Maryland led 29-24 before Zeller made a layup, McAdoo hit a jumper and Henson sank a free throw to knot the score.