Maryland men’s soccer midfielder Eryk Williamson didn’t pay attention to the mayhem behind him after he scored a 69th-minute go-ahead goal in Friday’s 5-4 win over Wisconsin.

Fellow midfielder Jake Rozhansky had just shoved Badgers goalkeeper Philipp Schilling, but Schilling hardly even reacted, too busy yelling in the referee’s face for a perceived missed foul call earlier in the play.

Williamson, meanwhile, focused on his goal celebration, sliding on both knees toward the corner flag before glancing over his shoulder toward the action in middle of the field. Perhaps he knew that compared to the final 20 minutes of Maryland coach Sasho Cirovski’s 400th-career victory, the commotion was rather tame.

“This will be a memorable one,” Cirovski said, “for a variety of reasons.”

Less than two minutes later, Williamson entered another celebratory slide, having put Maryland ahead 4-2 and leaving Schilling frustrated again. Schilling had slipped on the grass slicked by heavy rain throughout the game and, once he got up, kicked the left post Williamson had just curled a shot inside.

Williamson completed his second-half hat trick in the 85th minute to give No. 3 Maryland (10-0-3, 5-0-3 Big Ten) a seemingly safe 5-2 lead.

Maryland had started slowly, going down 1-0 in the seventh minute before midfielder Amar Sejdic scored a pair of goals in the 20th and 36th minutes that gave Maryland a 2-1 lead and set the stage for Williamson to take over after the break.

“Our quality started to come through in the second half,” Cirovski said. “We were able to get some exceptional goals.”

But Wisconsin (7-3-3, 3-2-1) forged a comeback in the game’s dying stages, taking advantage of an 83rd-minute red card to defender George Campbell — one of seven cards in the game — that left the Terps with 10 men.

Williamson said being a man down meant the team knew its lead was never secure, and sure enough, the Badgers forged a comeback that kept them in the game until the very last second.

“We [fouled them and] gave them opportunities and they weren’t necessary,” midfielder Amar Sejdic said.

The Badgers turned one of those chances into a goal in the 85th minute. Midfielder Chris Mueller converted a penalty kick and, with the Badgers still trailing 5-3, rushed towards the net to pick up the ball and run it back to midfield for a quick restart.

But Maryland goalkeeper Dayne St. Clair — who had taken offense to being fouled earlier in the game — kept Mueller from gathering the ball. A minor scrum broke out after St. Clair shoved Mueller.

Wisconsin pulled within 5-4 with just 40 seconds left on the clock. Then, the Badgers nearly scored a last-second equalizer, but the header deflected just wide.

The referees stopped the clock to allow Wisconsin to take a final corner kick. St. Clair saved the effort, preventing a collapse reminiscent of Maryland’s 5-4 loss to Providence in its first game of the NCAA tournament last year.

“We have to learn … how to manage the emotion a little bit better in those key moments,” Cirovski said.

Even with the clock at zero, the chippiness continued.

St. Clair was knocked down after catching the Badgers’ final shot, setting off another fracas in front of Maryland’s goal before cooler heads prevailed.

“After the game it’s just a huge sigh of relief that you got through those hectic five minutes,” Williamson said. “We’re just happy that we got away with a win.”