MANHATTAN, Kan. (AP)Two weeks ago, Texas let a game against Oklahoma State slip away in the fourth quarter.

The Longhorns weren’t about to let it happen again.

After riding Bijan Robinson to a 31-10 halftime lead at Kansas State, then watching the No. 13 Wildcats come roaring back down the stretch, the Longhorns’ defense stepped up one last time. Keondre Coburn stripped Adrian Martinez near midfield with 34 seconds to go, Jaylan Ford pounced on the loose ball and Texas escaped with a 34-27 victory Saturday night.

”We just understood that we’re not going to lose again on the road. That’s when the fight came out,” said Robinson, who ran for 209 yards and a score. ”The defense came up clutch. They understood that they had to put the game on their backs and they had to stop them and execute and that’s what they did.”

Quinn Ewers threw for 197 yards with two TD passes to Xavier Worthy, and Roschon Johnson added a TD run for the Longhorns (6-3, 4-2 Big 12), who control their own destiny in the race for the Big 12 title game.

They begin a three-game finishing gauntlet against No. 7 TCU next week before games against Kansas and Baylor.

”I told the guys, `We’re not done. We have more work,”’ Longhorns coach Steve Sarkisian said. ”We have a great opportunity ahead of us in this entire month of November. What you do in November is what everybody remembers.”

Martinez threw for 329 yards and two TDs, but he also threw an interception that turned into a Texas touchdown and had the fumble the clinched the game. Deuce Vaughn had 73 yards rushing along with 86 yards and a touchdown receiving.

”The guys stayed in the fight,” said Wildcats coach Chris Klieman, whose team hasn’t beaten Texas since 2016. ”When you are down that big at halftime, a lot of things can go wrong. It’s a credit to the character and leadership in that room.”

The momentum swung to Texas on the fourth play of the game, when Kansas State’s Julius Brents earned a questionable targeting penalty, taking the Wildcats’ best cover cornerback off the field for the rest of the game.

The Longhorns proceeded to reel off three straight touchdown drives, all going eight plays and 75 yards. Robinson capped the first with a 36-yard run, Johnson finished the second from nine yards out, and Worthy capitalized on Brents’ absence by hauling in the first of his two TDs to give the Longhorns a 21-10 lead.

The only time Kansas State (6-3, 4-2) got off the field came when Johnson fumbled at the end of a 37-yard gain. But the Wildcats promptly punted away, Texas added a field goal, and then Martinez was picked off in the closing minutes to set up Worthy’s second touchdown reception and extend the lead to 31-10 at the break.

The Longhorns had 352 yards of offense by that point against a Kansas State defense that limited Oklahoma State to 217 total in a 48-0 win last week. Robinson had bullied his way for 161 on the ground, the best half of his career.

”Bijan Robinson, period,” Klieman said. ”I think he’s one of the best running backs in college football for a reason.”

Kansas State mounted a second-half comeback, and it was that struggling defense that jump-started it. Josh Hayes popped another fumble loose and, after a series of penalties, Martinez scored from a yard out to make it 31-17.

Martinez then hit Kade Warner from 25 yards out on the first play of the fourth quarter to make it a touchdown game.

Texas and Kansas State promptly traded field goals, but the Wildcats’ kick came after a time-consuming drive that drained more than 6 minutes off the clock. It got them within 34-27 but with just 4:26 left in the game.

The Wildcats stuffed Robinson on third down to get the ball back, and Martinez quickly moved them to midfield. But after converting fourth down with a pass to Vaughn with 34 seconds to go, the senior quarterback – getting the start over Will Howard, who had been dynamic last week against the Cowboys – fumbled the ball away.

”We had a chance to win it in the fourth quarter,” Klieman said. ”We just made too many mistakes.”

THE TAKEAWAY

Texas lost a pair of fumbles and failed to convert on fourth down, but otherwise the offense was nearly unstoppable in the first half. In the second, the Longhorns managed to make just enough to plays to keep Kansas State at bay.

Kansas State made far too many mistakes, beginning with the Brents penalty and personal fouls on center Hayden Gillum and linebacker Daniel Green. The Wildcats finished with nine penalties for 85 yards in an uncharacteristic performance by one of the better disciplined teams in the Big 12.

UP NEXT

The Longhorns plays No. 7 TCU next Saturday night.

The Wildcats head to Baylor the same night.

More AP college football: https://apnews.com/hub/college-football and https://twitter.com/ap-top25. Sign up for the AP’s college football newsletter: https://tinyurl.com/mrxhe6f2