AMES, Iowa (AP) — For two teams used to seeing games come down to the final play, it was fitting that Iowa State and Texas left it all up to a kicker.

Connor Assalley drilled the field goal of his life, sending the Cyclones home a rare winner over the Longhorns.

Assalley kicked a 36-yarder as time expired and Iowa State knocked off 22nd-ranked Texas 23-21 on Saturday to snap a two-game losing streak.

Brock Purdy had 354 yards passing and two TDs, and he led the Cyclones (6-4, 4-3 Big 12) 63 yards in three minutes to set up Assalley’s winner.

Iowa State, a favorite over Texas for the first time, picked up just their third win over the Longhorns (6-4, 4-3) in 17 tries despite blowing a 13-point lead.

“They continue to fight when I think everyone has written us off at times,” Iowa State coach Matt Campbell said. “Our kids just keep playing.”

Iowa State’s Brayden Narveson missed an apparent 42-yard field goal with 2:12 to go. But Texas was called for being offside and the Cyclones were awarded a first down by inches.

The Cyclones — who have lost twice by a point in 2019 — elected to play for the field goal. Assalley rewarded Campbell’s faith in him with a no-doubter right down the middle.

Sam Ehlinger gave Texas a 21-20 lead with a brilliant 7-yard TD pass to Malcom Epps on fourth down with 5:37 to go. But the Cyclones stuffed the Longhorns on their next possession, giving Purdy one more chance.

“My mindset was we were going to have to go back on to the field,” Ehlinger said after the Longhorns’ final score. “We were celebrating that one too much. We did and couldn’t get a first down.”

Ehlinger had 273 yards and three TDs for Texas, losers of three of its last five. The Longhorns sealed their last two victories, over Kansas and Kansas State, with game-winning kicks with no time left.

Texas ran the ball 26 times for 54 yards, with backs Roschon Johnson and Keaontay Ingram combining for 27 yards.

“Obviously a really, really poor performance by our offense the first two quarters,” Texas coach Tom Herman said. “Not being able to run the ball the way we thought we would be able to was the biggest difference.”

(© Copyright 2019 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)