This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

MEMPHIS, Tenn. (AP) — Bijan Nichols kicked a 23-yard field goal with two seconds remaining and No. 21 Navy capitalized on a fourth-down gamble in the final minute to beat Kansas State 20-17 in the Liberty Bowl on Tuesday.

A Navy team with the nation’s top-ranked rushing attack set up the winning score by completing a halfback option pass with less than 30 seconds left. The Midshipmen snapped the ball on fourth-and-3 from the Kansas State 46. Quarterback Malcolm Perry pitched to C.J. Williams, and he threw downfield to a wide-open Chance Warren for a 41-yard gain.

“Sometimes you just go with your gut,” Navy coach Ken Niumatalolo said. “You have all this analytics stuff and all these sheets, but sometimes you’ve got to go with your gut and roll with it.”

Navy’s J.R. Osborn (18) grabs kicker Bijan Nichols (43) as Billy Honaker (71) and Kendel Wright (76) rush in to celebrate Nichols’ winning 23-yard field goal against Kansas State in the final seconds of the fourth quarter of the Liberty Bowl NCAA college football game Tuesday, Dec. 31, 2019, in Memphis, Tenn. Navy won 20-17. (AP Photo/Mark Humphrey)

Perry, who rushed for 213 yards, spiked the ball with 5 seconds left to set up Nichols’ field goal. Nichols had missed a 38-yarder earlier in the fourth quarter.

The victory enabled Navy (11-2) to tie a program record for wins and ensured the Midshipmen will finish a season in the AP Top 25 for just the third time in the last 56 years. Navy finished 18th in 2015 — when it also won 11 games — and was 24th in 2004.

Navy went 3-10 last year and matched the second-biggest season-to-season improvement in win-loss record of any team in Football Bowl Subdivision history. Hawaii owns the record by going 9-4 in 1999 after finishing 0-12 in 1998.

“Everything that happened this year isn’t surprising to me because they did the work, they paid the price,” Niumatalolo said. “They did everything that was asked of them.”

The Mids made that dramatic turnaround thanks largely to Perry, who capped a brilliant senior season with 28 carries and a touchdown pass.

Perry ran for 2,017 yards this season to set a Football Bowl Subdivision record for yards rushing by quarterback. The record had been owned by Jordan Lynch, who ran for 1,920 yards for Northern Illinois in 2013.

Navy dominated much of the game but wasted a couple of opportunities to put it away. The Mids led 17-10 late in the third quarter when a holding penalty on Billy Honaker wiped out a 31-yard run by Perry that would have given them first-and-goal at the 2. Navy ended up punting.

Kansas State quarterback Skylar Thompson (10) is sacked by Navy defensive end Jackson Perkins (96) for a 4-yard loss in the first half of the Liberty Bowl NCAA college football game Tuesday, Dec. 31, 2019, in Memphis, Tenn. (AP Photo/Mark Humphrey)

Nichols then sent a 38-yard field goal attempt wide left with 8:26 left in the game. At that point, Navy was outgaining Kansas State 351-83 but only led 17-10.

Kansas State finally got its offense going at that point, as Skylar Thompson connected with Wykeen Gill on a 15-yard completion and a 42-yard pass on back-to-back plays. Those long gains set up Thompson’s 1-yard sneak that tied the game with 5:14 left.

That set up Navy’s dramatic winning drive.

“I thought we did a really nice job of slowing them down in the red zone,” Kansas State coach Chris Klieman said. “Give them credit. They pulled out a couple of trick plays at the right time, and they made those plays.”

THE TAKEAWAY

Navy: A vastly improved defense sparked Navy’s turnaround and held Kansas State in check for much of the day. Kansas State’s offense didn’t reach the end zone for the first 54 1/2 minutes of the game. The Wildcats’ first touchdown came on a 66-yard punt return by Phillip Brooks, who also dropped a potential TD pass on the opening series.

Kansas State: The Wildcats ranked fourth nationally in time of possession during the regular season but couldn’t keep their offense on the field Tuesday as Perry and the Mids controlled the clock. Kansas State still has reason to feel good about itself. Picked before the season to finish ninth out of 10 teams in the Big 12, the Wildcats instead won eight games and stunned eventual Big 12 champion Oklahoma in Klieman’s debut season.

UP NEXT

Navy will head overseas to open the 2020 season Aug. 29 by facing Notre Dame at Dublin, Ireland. The Mids will have a tough time matching the quarterback production of Perry, who ended his college career Tuesday. Freshman Perry Olsen backed up Perry this season.

Kansas State opens its 2020 season Sept. 5 by hosting Buffalo. The Wildcats return Thompson and first-team all-Big 12 defensive end Wyatt Hubert but must replace graduate transfer running backs James Gilbert and Jordon Brown as well as their entire starting offensive line.