MORGANTOWN, W.Va. — Suddenly, Texas has just a week left in a stunningly bad season under first-year coach Steve Sarkisian.

On the other side, West Virginia will get one more chance to avoid joining the Longhorns in ending the year in late November.

Jared Doege threw three touchdown passes and Leddie Brown rushed for 158 yards and a score to lead the Mountaineers to a 31-23 victory over Texas on Saturday, handing the Longhorns their sixth straight loss and eliminating them from bowl consideration.

West Virginia (5-6, 3-5 Big 12) snapped a two-game losing streak and kept its postseason hopes alive, but needs to win its final game next weekend.

“It gets us to five,” West Virginia coach Neal Brown said. “It keeps us alive for another week.”

Texas (4-7, 2-6) couldn’t overcome another double-digit deficit. The Longhorns will finish with a losing record and miss a bowl for the first time since 2016. The losing streak for Texas is its longest since it dropped eight in a row in 1956.

“We just haven’t broken through yet, and that’s the biggest frustrating part,” Sarkisian said. “Every game, it seems like there is a different story to tell of why it didn’t happen. I hate it for the guys because they bring it every day.”

Texas never led but had two chances to potentially tie the score in the final 3 minutes.

The Longhorns drove to the West Virginia 30 but on fourth down, Casey Thompson was intercepted by Sean Mahone at the 6.

West Virginia then drove to the Texas 36. The Mountaineers went for it on fourth down rather than attempt a long field goal, but Doege threw incomplete into the end zone and Texas got one last chance with 36 seconds left.

The Longhorns couldn’t get past midfield and Hudson Card’s fourth-down pass fell incomplete. Texas was outgained 459-355.

Alabama transfer Keilan Robinson, who was in COVID-19 protocols and sat out the Longhorns’ overtime home loss to Kansas a week ago, had a 49-yard scoring run midway through the second quarter. Robinson also had a 25-yard carry during a third-quarter drive that led to Roschon Johnson’s 6-yard TD run that pulled Texas within 28-23 with 12:25 left.

West Virginia’s Casey Legg kicked a 45-yard field goal for the final margin.

Texas went three-and-out on its first four possessions. By then, Doege had thrown TD passes of 20 yards to Sam James and 14 yards to Winston Wright for a 14-0 lead early in the second quarter.

Doege also had a 7-yard TD toss to Sean Ryan in the third quarter on a drive that didn’t start so well. Doege was sacked on two straight plays and converted a third-and-17 pass from his 18. Brown followed with runs of 26 and 18 yards to put the Mountaineers inside the Texas 20.

Doege finished 27-of-43 for 290 yards.

Thompson had one of his worst outings of the season, completing four of 14 passes for 29 yards after throwing for 358 yards against Kansas a week ago. Card played most of the second half and went 10-of-16 for 123 yards with one touchdown.

“Offensively, not nearly enough consistency in the passing game,” Sarkisian said.

Texas hosts Kansas State in the regular-season finale on Friday.