Matz Stockman would not be playing college basketball this season if the Gophers had given away his scholarship in June after he announced he was transferring.

Two weeks after Stockman told coach Richard Pitino he was pursuing more playing time elsewhere, the 7-foot senior from Norway posted on Twitter he was committing to California.

The plan to leave Minnesota hinged on Stockman graduating in the summer and using the NCAA’s grad-transfer path to play right away at Cal. Stockman came just short of getting his degree, though, so he had nowhere to go — unless Pitino took him back.

That turned out to be the best thing for him and the Gophers, who saw Stockman save his best for last with a memorable Senior Night performance in Tuesday’s 73-69 victory over No. 11 Purdue. The Gophers (19-11, 9-10 Big Ten) could use an encore performance Friday night, when they visit No. 24 Maryland (21-9, 12-7) in the regular-season finale.

VideoVideo (09:57): Gophers coach Richard Pitino, Amir Coffey and Dupree McBrayer talk in preparation for regular finale at Maryland

“It’s a little bit more personal, because I knew Matz at Louisville,” Pitino said. “He also lost a father a couple years ago, which was really, really challenging for him. Obviously, he was going to move on and wasn’t able to complete that work. We were lucky enough to keep him.”

Chants of “MVP, MVP, MVP” echoed throughout Williams Arena on Tuesday when Stockman came off the bench to dunk, board and block his way to a career game. In 24 minutes against the Boilermakers, he had nine points, six rebounds and seven blocks. His size and length (7-6 wingspan) helped the Gophers contend with Matt Haarms, Purdue’s 7-3 center, and replace the presence of redshirt sophomore big man Eric Curry, out for the season because of a right foot injury.

Minnesota’s talented freshman starting center Daniel Oturu was struggling to make an impact Tuesday, so Stockman’s production was arguably the difference in the battle in the post.

“I was surprised,” Stockman said of the “MVP” chants. “I just felt like we absolutely needed to get this win [Tuesday night]. So I just tried to play with as much energy as I could.”

Stockman said Pitino told the team it had to beat Purdue to solidify an NCAA tournament at-large bid.

“Before the game we were on the edge of making the tournament,” Stockman said. “That’s what Pitino kept talking about that if we get this win, then we’ll for sure be in the tournament. So we were super locked in.”

Immediately after Curry suffered the season-ending injury during Monday’s practice, Pitino met with Stockman individually to make sure he knew the Gophers would be counting on him for a much bigger role. Stockman had not played in three games, and he was averaging 1.3 points and 1.4 rebounds in only 7.5 minutes a game in Big Ten play.

Earlier in the season, Stockman played at least 10 minutes in nine of his first 10 games, but he hit that mark only three times in the next 13 games once Curry recovered from knee surgery. The Gophers are still 11-2 when Stockman plays double-digit minutes.

“It’s hard to play three guys at one position,” Pitino said. “That’s what’s challenging, but being a part of a team, you got to be ready. To Matz’s credit, he was ready.”

Tuesday won’t be the last time Stockman will be needed to perform at a high level. Oturu and senior Jordan Murphy likely will need help Friday battling the frontcourt length and athleticism of Bruno Fernando and Jalen Smith, who combined for 31 points and 19 rebounds Jan. 8 in an 82-67 Gophers loss against Maryland.

Stockman would have competed for the starting center spot at Cal, but he had to stay and be a backup at Minnesota. He’s still grateful for that opportunity.

In his speech to fans, some of whom stormed the Williams Arena court after the Purdue game, Stockman thanked Pitino for welcoming him back.

“Thanks first and foremost to Coach Pitino, who took me back when I didn’t have a place to transfer to,” Stockman said. “I’m extremely grateful for that.”