CHAPEL HILL, N.C. — North Carolina wide receiver Tez Walker had a protracted battle with the NCAA, trying to secure his eligibility for this season.

He showed why the No. 12 Tar Heels (6-0, 3-0 ACC) wanted him on the field so badly, scoring three touchdowns to lead North Carolina to a 41-31 win over No. 25 Miami (4-2, 0-2 ACC) at Kenan Memorial Stadium in Chapel Hill, North Carolina, on Saturday. The loss was the Hurricanes’ second in a row and their fifth straight defeat against the Tar Heels.

“He’s a good receiver,” Miami defensive back Te’Cory Couch said. “Good, fast, long receiver. He made plays when his number was called.”

UNC quarterback Drake Maye finished the game with 17 completions on 33 passes for 273 yards. Three of his four touchdowns went to Walker.

“He’s a great quarterback,” Couch said. “I never thought he wasn’t, even throughout the game when we started to put pressure on him and he started to struggle a little bit. I never thought he wasn’t a great quarterback.”

Although Miami ultimately suffered a 10-point loss, UM got off to a solid start.

Down 7-0, the Hurricanes drove down the field, only for disaster to strike at the goal line. Henry Parrish Jr. was inches away from scoring Miami’s first touchdown of the night when Jahvaree Ritzee punched the ball loose. The ball came out before the UM running back could cross the goal line. Cedric Gray recovered it, stymieing Miami’s momentum.

Miami was not done making big mistakes. After Kamren Kinchens sacked Maye on a third-down, unencumbered safety blitz, Keontra Smith was flagged for unsportsmanlike conduct after taking a swipe at a North Carolina player’s face. However, Miami recovered and forced a punt three plays later.

The Hurricanes, aided by two Tar Heels penalties, drove down the field and got on the board on an 18-yard touchdown from Tyler Van Dyke to a wide-open Xavier Restrepo.

Miami took the lead in the second quarter but got a big scare on the same play. Van Dyke tossed his second touchdown pass of the game, a 35-yard dime to Jacolby George. But UNC linebacker Power Nichols drilled Van Dyke in the chest with his helmet, and the UM quarterback went to the ground with what appeared to be an injury. But Van Dyke returned on the subsequent drive without missing any plays.

UM had another fourth-down breakdown late in the second quarter. Miami was trying to call a timeout, and defensive coordinator Lance Guidry ran onto the field. The officials called Guidry for an unsportsmanlike conduct, giving UNC a red-zone first down. Three plays later, Tar Heels running back Omarion Hampton, who rushed for 197 yards, scored a 2-yard touchdown.

But the Hurricanes were not the only ones making mistakes. North Carolina committed 14 penalties for 147 yards. Miami got a stop late in the second quarter and got the ball back with 55 seconds left in the first half. They drove down the field, aided by a pair of UNC offsides, and kicked a go-ahead field goal. That would be the end of the positive developments for the Hurricanes.

UNC came out firing in the second half, scoring on a 56-yard bomb from Maye to Walker as the pair connected for their second score of the game. Miami tried to match North Carolina, but after connecting on a flea-flicker for a first down, Van Dyke fumbled a snap and turned the ball over to the Tar Heels.

Luckily for Miami, the defense stepped up, and the fumble did not come back to bite the Hurricanes. But the Tar Heels continued to rack up second-half scores. They put up 21 unanswered points in the third quarter, as Maye connected with Walker again and then tossed his fourth touchdown of the game, to Hampton, to go up 35-17.

“We’ve just got to execute,” Van Dyke said. “That’s the main thing. We’ve got to play consistent football for four quarters. We can’t have these up-and-down moments during the game. We’re not going to win football games, especially against a good team like that.”

After a UNC field goal, Miami cut into the lead on Van Dyke’s second touchdown pass to Restrepo and a 54-yard touchdown pass to Brashard Smith, but it was not enough late in the game.

“We had been moving the ball really well those last four series of the first half, and we come out the second half, they score twice and we turn the ball over twice,” UM coach Mario Cristobal said. “That took the momentum. We found ourselves trying to catch that momentum back and never did.”

Five takeaways

Hang onto the ball

Miami struggled with turnovers for the second game in a row. After giving the ball to Georgia Tech five times last week, the Hurricanes turned the ball over four times on Saturday.

Parrish fumbled at the goal line, turning what would’ve been an early score into UNC’s ball. Van Dyke was responsible for a pair of turnovers, fumbling a snap and throwing a brutal pick that gave the Tar Heels the ball in the red zone. Van Dyke also threw an interception on the final play of the game. UNC turned the last of those into seven points to take a double-digit lead.

Miami has turned the ball over nine times in the last two games.

“We had been really good about holding onto the ball early in the season,” Cristobal said. “The last couple of games, it’s gotten us.”

Get off the field

The Hurricanes shot themselves in the foot multiple times when they were close to getting the defense off the field.

Miami committed two brutal unsportsmanlike conduct penalties when they should have been working special teams. The first was on linebacker Keontra Smith. The second was on Guidry. Both resulted in first downs, and the Guidry penalty set up a touchdown run by Hampton.

After Van Dyke’s interception, Miami’s defense pushed North Carolina back and had a 3rd-and-20 but surrendered a touchdown pass to Walker that put the Tar Heels up 28-17.

Miami’s defense gets home

The Hurricanes had been generating pressure on opposing quarterbacks all season, but they struggled to actually put the quarterbacks on the ground. Miami entered the game 76th in the nation with only 12 sacks.

But the Hurricanes got to Maye frequently on Saturday. Miami racked up a season-high five sacksKinchens, linebacker K.J. Cloyd and Francisco Mauigoa and defensive linemen Rueben Bain Jr. and Jared Harrison-Hunte had sacks.

“I think that play design, scheme design, was helpful,” Cristobal said. “I think guys like Rueben Bain playing more downs, more snaps, we’re really starting to feel comfortable playing at this level, being a freshman. Having Branson Deen back has helped a bunch, as well. He’s. a good football player. I know Nyjalik got banged up. A couple other guys really popped and showed out and strained, like really strained, to get to the quarterback. Rushing the passer is an attitude. It’s a demeanor. It’s a mentality. It’s at all costs, right? And we have a couple guys that have that.”

Pass defense plays well … except when it doesn’t

Maye is likely the best quarterback Miami will face all season. He will likely be a top NFL draft pick next year. The Hurricanes held him to 52 percent on his pass attempts, by far his lowest completion percentage of the season.

However, the sophomore quarterback had a knack for the big play, connecting on four touchdown passes. Maye had 16.1 yards per completion.

“We affected the quarterback in the first half and limited the explosive plays,” Cristobal said. “They got their explosive plays. They made them and got us on them in the second half. Tempo affected us a little bit more, and we didn’t affect their quarterback as much.

Jacolby George’s strong performance

The junior wide receiver was a bright spot on Miami’s offense.

George racked up a career-best 125 yards on six catches and scored a touchdown.

“I don’t really feel great. We lost,” George said. “I did have a career high, but at the end of the day, we still lost.”