Mark Smith scored 22 points, Nijel Pack made a go-ahead layup with 1:13 left, and Kansas State held No. 23 Texas scoreless for the final 3 1/2 minutes to rally for a 66-65 win on Tuesday night.

Marcus Carr scored 19 of his season-best 25 points in the second half for Texas but missed a jumper with 2 seconds left, one of Texas' two chances to take the lead in the final minute. Courtney Ramey also misfired on a potential go-ahead jumper as Texas missed its last four shots from the field.

Pack finished with 16 points and Mike McGuirl added 13 for Kansas State (10-7, 2-4 Big 12), which closed the game with a 6-0 run.

Kansas State coach Bruce Weber calls to players during the second half of an NCAA college basketball game against Texas, Tuesday, Jan. 18, 2022, in Austin, Texas. (AP PhotoEric Gay)

Kansas State coach Bruce Weber calls to players during the second half of an NCAA college basketball game against Texas, Tuesday, Jan. 18, 2022, in Austin, Texas. (AP PhotoEric Gay)

Timmy Allen scored 15 points for Texas (13-5, 3-3), and his layup with 3:32 left put the Longhorns ahead 65-60. He missed two free throws with 2:26 left and Texas leading 65-62. Markquis Nowell followed with two free throws for the Wildcats.

The game was tied at 55 when Texas’ Christian Bishop blocked a driving attempt by Nowell. Carr followed that play with consecutive mid-range jumpers, giving the Longhorns a four-point lead.

Texas led 35-31 after a first half in which both teams got into foul trouble. Each was whistled 12 times. Texas had five players with two fouls while Kansas State had four.

Smith, a rugged 6-foot-4, 225-pound guard who played at Illinois and Missouri before Kansas State, was too tough inside for Texas to handle. He hit 5 of 7 shots in the first half.

BIG PICTURE

Kansas State: The Wildcats look like a new team lately. They were at full strength for the first time this season during a 62-51 win over No. 18 Texas Tech on Saturday. They were without coach Bruce Webber, two starters and a top substitute because of COVID-19 issues during a 70-57 loss to Texas on Jan. 4, while the Longhorns were missing Andrew Jones.

Texas: The Longhorns continue to struggle from 3-point range. They missed 13 of 17 against Kansas State and are hitting 31% in Big 12 play.

UP NEXT

Kansas State: Hosts No. 7 Kansas on Saturday.

Texas: Hosts Oklahoma State on Saturday. The Cowboys beat the Longhorns 64-51 on Jan. 8 in Stillwater.

More AP college basketball: https://apnews.com/hub/college-basketball, https://apnews.com/hub/ap-top-25-college-basketball-poll and https://twitter.com/AP_Top25