AMES, Iowa — The Kansas State Wildcats had it in hand, but as was the case for much of their 2018 season, it slipped through their fingers.

The Wildcats led No. 25-ranked Iowa State by 17 with 12 1/2 minutes left Saturday night, only to watch in disbelief as the Cyclones reeled off 21 straight points down the stretch to pull off a 42-38 victory at Jack Trice Stadium.

The loss not only dashed K-State’s bowl hopes after staving off elimination the previous two weeks, but also called into question the future of hall of fame coach Bill Snyder.

“Listen, that is the last thing on my mind right now,” Snyder, 79, said of his timeline for making a decision on whether he will continue to coach next season.

K-State finished the season at 5-7 overall, 3-6 in the Big 12, while Iowa State improved to 7-4, 6-3, with a non-conference game remaining next week against Drake.

The disappointment was palpable for K-State, which was coming off back-to-back victories over Kansas and Texas Tech, needing just to run out the final 12-plus minutes to extend their bowl streak to nine years.

“I am going to have to think about how I respond from this loss in terms of what my feelings are,” Snyder said. “Like I have said, I have just never experienced a loss like that, not even back whenever it was, ancient history.

“It just wasn’t to be, I guess.”

K-State all-Big 12 tackle Dalton Risner, a senior, was at a loss to explain the collapse.

“I wish I had the answer to that,” he said. “We gave up 21 points in the fourth quarter, so ...”

K-State had gone up 38-21 with 12 minutes, 27 seconds left when Skylar Thompson hit a wide-open Isaiah Zuber with a 4-yard touchdown pass. It was the second straight touchdown set up by cornerback Kevion McGee’s first two career interceptions.

But it was all downhill from there.

Iowa State answered with a 77-yard drive, scoring on a 3-yard touchdown pass from Brock Purdy to Sam Seonbuchner at the 10:18 mark. Disaster then struck for K-State when Thompson was sacked by Willie Harvey and fumbled, allowing Mike Rose to grab it and run 21 yards for the touchdown.

“It was just a frustrating turn of events,” Thompson, who completed 18 of 27 passes for 283 yards and three touchdowns in the game, said of the sack. “They got the momentum going their way, and the chances of the ball just falling right in his lap that way and returning it for a touchdown and a quick score like that after we were up 17 points, that was frustrating.”

After getting another stop, Iowa State drove 69 yards and took the lead on David Montgomery’s 18-yard run with 4:34 left. K-State converted one fourth down on its final possession but was stopped at the Iowa State 47 when Thompson’s long pass to Dalton Schoen on fourth down fell incomplete and no flag was thrown.

The loss overshadowed a big day on offense for K-State, which finished with 428 yards, including 245 on the ground. Alex Barnes ran for 184 yards and a touchdown and Zuber caught seven passes for 65 yards and two scores.

For Iowa State, Purdy was 20 of 27 passing for 337 yards and two touchdowns, plus the two McGee interceptions. Montgomery rushed for 149 yards and three touchdowns.

The question now for K-State is what Snyder will decide, though he offered no hints after the game. Earlier this year, he said he would wait until the end of the season, same as he has in recent years.

K-State athletic director Gene Taylor said Tuesday that he would wait until the end of the regular season to broach the subject with Snyder.

“I’ll say, ‘Coach, what are you thinking,’ ” Taylor said. “Win or lose (against Iowa State), it’ll probably be the same conversation, it’ll just be a little bit sooner (if they lose).

“I expect him to say he’ll think about it and get back to me.”

That was how the process played out last year, after the Wildcats went 8-5 and won the Cactus Bowl. Snyder announced in January that he was returning, then signed a five-year contract in August.

But Snyder had come under increasing scrutiny this season, when the Wildcats faced an uphill battle for bowl eligibility. Fans were disgruntled, and in the media several columnists urged him to retire.

Given Snyder’s age, Taylor said speculation about the future is only natural.

“Last year was my first year, obviously, and when we were 3-4 there was a lot of that question,” Taylor said. “Maybe it seems a little bit more this year in terms of more public questioning of that, but then we win five in a row and win a bowl game (last year) and it kind of went away, other than waiting for his decision.”