LINCOLN, Neb. (AP) — A Wisconsin team that has endured the midseason firing of its head coach and the death of a former teammate let its emotions spill out as groups of players gathered near midfield at Memorial Stadium to celebrate and pose for pictures with the Freedom Trophy.

Graham Mertz scored on a 2-yard quarterback sneak with 35 seconds left to complete a comeback from an 11-point deficit entering the fourth quarter, and the Badgers beat Nebraska 15-14 Saturday for their ninth straight win in the series.

“It’s everything that this team has overcome off the field, that was what came up on the field today,” Mertz said. “There’s so many emotions and feelings that guys have had to deal with this year. There’s so many different things that have happened to us this year that could easily have buried us and made us just fold. It’s really cool to see how guys come together and want to succeed together.”

Wisconsin (6-5, 4-4 Big Ten) arrived in Lincoln with heavy hearts and left eligible for a bowl for the 21st straight year.

The Badgers had to cope with the death of former teammate Devin Chandler, who was one of three Virginia football players killed in a shooting last Sunday in Charlottesville. Interim coach Jim Leonhard had said late in the week that he sensed players who were friends with Chandler could be distracted.

“It was such a rough week, and early on the game mirrored that,” said Leonhard, 4-2 since taking over for the fired Paul Chryst. “It was ugly for a long time, and the guys just continued to battle and find ways to make plays.”

The Badgers were held to three points through three quarters and lost their top defensive player, Nick Herbig, to a targeting penalty and its top offensive player, Braelon Allen, to a leg injury on their second-to-last possession.

Mertz’s 10-yard TD pass to Skyler Bell cut Nebraska’s lead to 14-9. Mertz was off target with his 2-point pass, leaving the Badgers down five with 10 minutes left.

Wisconsin started its final drive from midfield with 3:11 left. Mertz passed to Isaac Guerendo for 27 yards to set up the winning touchdown.

“I’ve got to do a better job of closing people out,” Nebraska interim coach Mickey Joseph said. “I take my hat off to these kids. Just a good character group, a group that’s not going to quit. We’re going to come back next week and we’re going to play hard again and look for a different result. Just didn’t happen today. This one hurts.”

Casey Thompson, who missed the previous two games with an elbow nerve injury, threw two touchdown passes to Trey Palmer and finished 12 of 20 for 106 yards for Nebraska (3-8, 2-6).

Chez Mellusi led the Badgers with 98 yards on 21 carries. Mertz was 8 of 18 for 83 yards on a day when the feels-like temperature was 16 degrees with a gusty north wind.

Herbig was ejected for targeting when he hit a sliding Thompson in the head. By rule, Herbig must miss the first half of next week’s rivalry game against Minnesota.

Allen, already playing with a banged-up shoulder, had 92 yards on 18 carries before he hopped off the field with an apparent leg injury late in the game.

“There was a lot going on this week,” Allen said, “and that was a great way to turn the rough side of the week into something positive and get a big win and keep the trophy at home.”

THE TAKEAWAY

Wisconsin: The Badgers had to work hard for this one even though they rushed for 235 yards and outgained the Huskers in total offense 318-171. There was no immediate word on the extent of Allen’s injury.

Nebraska: This was a crushing loss for a team desperate for its first win since Oct. 7. The Huskers suffered a big blow when safety Marquis Buford left with a leg injury on the second play.

MAKING HIS CASE

The game was the Big Ten’s first that matched interim head coaches since Illinois’ Bill Cubit and Minnesota’s Tracy Claeys squared off in 2015. Leonhard said he hopes he’s made a case to have the interim tag removed.

“We’re playing much better,” he said. “Winning games is No. 1, and there’s a way, style, even in a loss — how you play, togetherness, how hard you fight, that matters. Even in games we come up short, the fight and grit factor have been there.”

UP NEXT

Wisconsin hosts Minnesota on Saturday looking to get back Paul Bunyan’s Axe.

Nebraska closes on the road at Iowa, which has beaten the Huskers seven straight times.