NEW YORK (AP) Melo Trimble began his move around midcourt, went around a screen and drove to the rim. After Trimble scored and Maryland got one last defensive stop, bedlam ensued.

Trimble converted a layup with 6.6 seconds remaining as the Terrapins survived a stiff challenge from Kansas State in a 69-68 victory Saturday night in the Barclays Center Classic Championship game.

Trimble scored 18 points and his biggest hoop came on Maryland's (7-0) final possession. He drove through the lane and got by Kansas State forward D.J. Johnson for the basket. Trimble hit his basket after Kansas State's Wesley Iwandu missed the front end of a 1-and-1 with 14 seconds left. Following a timeout, Trimble gained possession and went around a screen by Damonte Dodd that prevented Iwandu from providing a double team.

''Just don't settle,'' Trimble said. ''I've been in that situation since I've been at Maryland. I just know the best decision when the game's going like that is to just go to the basket.''

After Trimble missed the subsequent free throw, Kansas State (5-1) had one more chance but Barry Brown's jumper from the left side was short. Trimble celebrated with his teammates near center court, and then raced over to the first row and slapped hands with Maryland fans.

''I was happy we won,'' Trimble said. ''I didn't know what to do. I just was just happy to see so many people over there from Maryland.''

Johnson nearly willed Kansas State to the win by totaling a career-high 26 points and getting eight rebounds before fouling out on Trimble's dramatic drive. ''He just gets a head of steam,'' Wildcats coach Bruce Weber said. ''We knew what was coming and talked about it in the huddle. We said it's coming and he's good at it.''

Michal Cekovsky added a career-best 16 points for Maryland, highlighting his game with three thunderous dunks midway through the second half. Cekovsky missed the first five games of the season recovering from a sprained foot and a preseason hamstring injury.

Iwundu added 16 points and 11 rebounds for Kansas State.

The game was tied 56-56 following a dunk by Johnson with 5:35 left. The Wildcats took a 61-59 lead on a 3-point play by Johnson but Maryland tied it on Trimble's layup with 3:18 remaining.

Kansas State took a 64-61 lead on a 3-pointer by Kamau Stokes and held a 66-63 edge on two free throws by Johnson. The Wildcats had a 68-65 lead when Johnson rebounded a miss by Brown and easily scored with about a minute to go.

Johnson had a chance to further seal it for Kansas State but missed the put-back attempt of Brown's 3-pointer, and with 44 seconds left he turned the ball over. Trimble drove by Johnson for a layup to make it 68-67.

Iwundu inbounded to Brown, who nearly stepped out of bounds. Brown missed a free throw with 14.3 seconds to play, setting up Trimble's drive.

POLL IMPLICATIONS

Kansas State: Kansas State may get some votes for being 5-1, but it appears there are too many other teams to warrant consideration for the Wildcats to actually enter the Top 25. Kansas State's only remaining non-conference game against a power conference team is Dec. 10 against Washington State.

Maryland: Maryland was No. 25 in the preseason poll but has been in the others receiving votes section. The Terrapins were seven points shy of No. 25 in the first in-season poll. Their 55 points in this week's poll made them the second team outside of the top 25. The two teams listed at No. 25, Michigan and Florida State, both lost this week, leaving it possible the Terrapins could re-enter the poll in time for games against Pittsburgh and Oklahoma State.

MOST VALUABLE PLAYER

Trimble was named the MVP of the tournament by getting 49 points on 16-of-31 shooting as the Terrapins received their fourth straight in-season tournament trophy. ... Trimble's play gave Maryland its second 7-0 start in the last three seasons and it made him the MVP of an in-season tournament for the third straight season.

UP NEXT

Kansas State: Hosts Wisconsin-Green Bay on Wednesday.

Maryland: Hosts Pittsburgh on Tuesday in the ACC-Big 10 challenge.

Copyright 2016 by STATS LLC. Any commercial use or distribution without the express written consent of STATS LLC is strictly prohibited.