MIAMI GARDENS — By the time Fernando Mendoza ran across the line on fourth down, then bulled over a couple of Hurricanes defenders and stretched the ball over the goal line, the national championship game had more than its defining play.

Indiana had the crystallized moment to say it rightfully earned the national title, just as it kept doing all the way to the interception of Miami quarterback Carson Beck in the final minute to seal its 27-21 win in the College Football Playoff title game.

For once, you see, the magic was on the other side. That’s what happened to Miami. All this past month of college playoffs, Miami had been the team intercepting a pass in the end zone at the end to beat Texas A&M or the one where Beck ran into the end zone to beat Mississippi.

Now, it was Indiana having the moment to hang a national title on. Mendoza stood in the confetti-covered field afterward and looked at his bruised right forearm, the one that cracked against Miami defenders en route to that touchdown that proved the winning points.

“It’s worth the bruises,’’ he said.

That bruising started, as everything at Indiana did, with coach Curt Cignetti making the kind of situational decision many coaches wouldn’t. Here was the situation: fourth-and-4 at Miami’s 12-yard line. Indiana led, 17-14, in the fourth quarter.

“We ran on the field-goal team, and that didn’t feel right so we took a timeout,’’ Cignetti said.

After a slow start Miami’s offense was beginning to have its way with Indiana’s defense. Cignetti didn’t trust his lead. He already had gone for it on fourth down on this drive with Mendoza showing his Heisman Trophy form with a 17-yard completion for that first down.

Now, he made a second call befitting a national champion. He went for this fourth-and-4, and Mendoza showed his talent another way.

“You put the ball in your best player’s hands,’’ Cignetti said.

Mendoza took the shotgun snap and ran up the middle, the Miami kid making his biggest moment back home against the team that twice didn’t want him. That’s not to question Miami. No major team wanted Mendoza out of high school until Cal-Berkley lost a quarterback and signed him.

“The best thing that could’ve happened,’’ he said.

When you win the Heisman, when you’re the upcoming No. 1 pick in the NFL draft and when you help turn a classic loser into a national champion, everything worked out just fine. His parents, celebrating after his TD run, was sports at their best.

“Just a quarterback draw,’’ Cignetti said of that play. “He ran a linebacker over. He wasn’t going to be denied.”

Miami didn’t play the perfect game it needed to win. Indiana, in fact, dominated the first half by any number you pulled: 169 total yards to Miami’s 69; 11 first downs to Miami’s three; 4-for-7 in converting third downs to Miami’s 0-for-4.

Indiana looked physical, disciplined, tight-knit but Midwestern-ly modest enough in managing to control the pride of the Hurricanes — their offensive line. Miami had 12 rushes for just 20 yards in the first half. As if that weren’t enough, Miami’s sole scoring chance, a 50-yard field-goal attempt, went wide just before halftime.

It felt close to being over then. But the score said it couldn’t possibly be over. Indiana only led 10-0.

“We knew we just had to come out and play our game,’’ Miami coach Mario Cristobal said.

But could it find that game? The answer came in the opening minutes of the second half. Miami’s Rueben Bain sacked Mendoza to force an Indiana punt. Then, on Miami’s second play, running back Mark Fletcher Jr. sprinted around right end and kept going for a 57-yard touchdown.

Suddenly, Miami was Miami again. Suddenly, the national championship was up for grabs. Indiana struck back, blocking a punt and falling on it in the end zone for a touchdown late in the third quarter to go back up, 17-7.

Give Miami credit. It kept coming. Its 81-yard drive cut it to 17-14. All told, Miami had three separete 10-point deficits this game and responded by cutting each to three points. The final one was after Mendoza’s touchdown when its eight-play, 91-yard drive made it 24-21.

Those two drives — the 81-yarder and 91-yarder — explain why Cignetti kept going for it on fourth down. They also explain why when Indiana only got a field goal to go up six points with a couple of minutes left, Miami had its chance.

That chance ended with Beck throwing the interception and Indiana throwing a party at Hard Rock Stadium. Miami walked off with the kind of season to be proud of. They just didn’t get the title. Sometimes, in sports, the magic is on the other side.