For the first time in nearly a full year, the Gophers won a Big Ten men’s basketball game. And they did it against one of the top teams in the country.

The Gophers snatched a big lead early and held on in a tight game late in defeating No. 6 Maryland 68-63 on Thursday night at Williams Arena, a victory that ended a 14-game losing streak and led to fans from the announced crowd of 10,768 rushing the floor.

“We’re not a perfect team right now, we’re not a complete team,” Gophers coach Richard Pitino said. “But to beat a really good team is exciting, and to beat them the way we beat them — with defense, with rebounds, with free throws — those guys just made big plays.”

Maryland trailed most of the game, but when Rasheed Sulaimon’s perfect three-pointer sank with 3 minutes, 4 seconds left, it finally put the Terrapins up 60-59, their first lead since early in the first half.

However, for the first time in more than two months, the Gophers weren’t done.

Joey King hit two free throws with 2:09 to go to put the Gophers back ahead, and Jordan Murphy hit one of two free throws with 53 seconds to go, making it a two-point game. After Sulaimon hit one of two from the line with 36 seconds left to keep the Gophers up by one, Nate Mason turned the ball over — but teammate Dupree McBrayer followed with a steal of his own.

This time, Mason turned the opportunity into another pair from the line, putting the Gophers (7-19, 1-13 Big Ten) up 64-61 with 20 seconds to go.

When Sulaimon, who finished with 28 points, missed a short jumper on the ensuing possession and the Gophers secured the rebound, the crowd, brimming at the seams, erupted.

“It was a blur for a minute there,” a smiling King said of the court rush. “I had never really gone through something like that.”

Mason finished with 18 points, six rebounds and six assists while helping hold Maryland point guard and leading scorer Melo Trimble to 3-for-11 shooting. Murphy added 17 points and 11 rebounds.

The victory, Pitino’s 50th in Maroon and Gold, not only ended that 14-game skid that encompassed the Gophers’ worst start to Big Ten play in program history, but it was their first regular-season conference victory since beating Michigan State on Feb. 26, 2015.

But the Terrapins (22-5, 10-4) — which played without standout freshman center Diamond Stone, suspended for the game after an incident in Maryland’s loss to Wisconsin on Saturday — had their chances. With 10 minutes left, the Gophers appeared to be falling apart.

After sinking seven of 10 three-pointers and taking a 40-29 lead at halftime, the Gophers suddenly were hitting nothing but backboard, getting tangled up at the rim and picking up shot-clock violations.

Maryland, unleashing its pressure defense, surged back within two after Sulaimon scored nine points in just over three minutes, and then brought the deficit to 56-55 when Trimble hit a short jumper with 5:13 to go.

“The second half showed us what we were made out of,” Mason said. “They made their run and we couldn’t knock down shots ...but we locked down to play together defensively.”

In fact, two days after senior Carlos Morris was dismissed for “conduct detrimental to the team,” the Gophers looked as steady as they have all season. With just over 10 minutes to go, the student section was already gleefully chanting “over-rated.”

“They deserve to walk around campus and not be ashamed of themselves,” Pitino said of his players, adding that he lifted the team’s curfew for the night.

So what are the big plans?

“We’ll probably just stay in,” Mason said. “Chill out.”

Then his eyes twinkled. And for the first time in a long time he threw his head back and laughed.