The University of Wisconsin men’s basketball was in any-way-possible mode Wednesday night.

Stuck in a rut and down two key players, the Badgers desperately needed a win. It didn’t matter to them whether it was pretty, ugly or even controversial.

As it turned out, UW’s 81-80 victory over Western Kentucky at the Kohl Center included all three of those elements.

Brad Davison’s free throw with 2.0 seconds remaining — which came after a foul that left Hilltoppers coach Rick Stansbury irritated — broke a tie and helped the Badgers escape with a win as they head into a break for final exams.

Ethan Happ and Brevin Pritzl scored 17 points apiece for UW (5-7), which had lost seven of its nine previous games. Davison added 16 and Aleem Ford had a career-high 14 for the shorthanded Badgers, who are without sophomore point guard D’Mitrik Trice (right foot) indefinitely and freshman wing Kobe King (left knee) for the rest of the season.

“It’s a good boost,” UW coach Greg Gard said, “because of how we were able to stay resilient and keep fighting and find a way.”

UW, which had lost its previous two home games by a combined 44 points, wasted an 11-point second-half lead against the Hilltoppers (6-4). But the Badgers did just enough good things down the stretch to pull out a win.

Davison was at the center of all of it. In the final minute, the freshman guard committed a turnover, took a charge, made a free throw to give the Badgers a 79-76 lead and committed a dumb foul after he missed the second attempt.

But his biggest contribution was drawing a foul on Western Kentucky’s Marek Nelson on a play drawn up in the huddle by Gard and assistant coach Joe Krabbenhoft.

After a runner by Taveion Hollingsworth tied the game at 79, the Badgers called timeout with 2.0 seconds left and diagrammed a play that has been in the Bo Ryan playbook for ages.

As former UW player Zak Showalter tweeted after the game, “We’ve had that play forever. That’s the first time I’ve seen it work!”

UW was 94 feet away from its basket, with Pritzl taking the ball out and Nelson aggressively guarding the inbounds pass. Enter Davison, who set a screen on Nelson as he was chasing Pritzl along the baseline.

When Nelson collided with Davison, knocking Davison to the ground, official Steve McJunkins whistled Nelson for a foul.

“I’m going to say this as nice as I can again,” Stansbury said. “I’m not going to put the blame on one play, but as it turned out it was an important play. It’s really an obvious play. If he’s out of bounds, he’s an illegal screener. And he’s out of bounds.”

Stansbury wanted officials to look at a replay, but he was told the play couldn’t be reviewed. Footage of the play appears to show that Davison remained inbounds while setting the screen.

“My job was to just let him run me over and it would be a foul on them,” Davison said. “Really good play call by coach and it worked perfectly, so we’ll take it.”

The Hilltoppers, who beat Purdue earlier this season, got 19 points from former Germantown standout Lamonte Bearden and 18 from Darius Thompson. They lost despite shooting 54.2 percent from the field, 50 percent from 3-point range and 81.8 percent from the free throw line.

UW, coming off an 82-63 home loss to Marquette on Saturday, shot 72.7 percent from the field after halftime and went 12 of 20 from 3-point range for the game.

Western Kentucky doubled Happ in the post in the first half and early in the second half, but Stansbury changed that strategy once Happ began finding open shooters. He finished with a game-high six assists, including four that led to 3-pointers in the second half.

“We gave up some 3s on that double team the second half,” Stansbury said. “It’s kind of choose your poison a little bit. It surprised me they had so many guys make shots tonight.”

Pritzl, who was 12 of 39 from 3-point range entering the game, went 4 of 5 from beyond the arc.

So did Ford, who was 10 of 29 entering the game.

Davison and junior guard T.J. Schlundt, meanwhile, made two 3-pointers each.

“It feels good when everybody’s hitting 3s, making shots, taking them confidently,” Pritzl said. “I think that’s just something that we have to keep doing, just taking them with that confidence that they’re going to go down, and they will.”

The Badgers’ hot shooting from the field made up for the fact they committed 15 turnovers and went 13 of 23 from the free throw line.

The last miss was by Davison, and it was on purpose. After making his first attempt to give UW a one-point lead, his second attempt was an intentional miss that could have been executed better.

The rebound ended up in the hands of Western Kentucky’s Jake Ohmer, whose desperation heave missed as the buzzer sounded.

“Greg’s lost some guys and he’s doing a heck of a job piecing that team back together,” Stansbury said. “He’s got them playing hard, he’s got them playing smart and they were a lot better tonight than they were Saturday, that’s for sure.”

Outbrain