Las Vegas • What was once a 17-point lead was completely gone. San Diego’s Olin Carter III was on fire and everyone at Orleans Arena not clad in BYU blue was squarely in the underdog Toreros corner.

The Cougars had not scored on their previous four possessions, but BYU coach Dave Rose didn’t cringe when junior captain Luke Worthington drew a foul and headed to the free-throw line, despite Worthington being a 58 percent free-throw shooter.

“As a leader of our group, I just said this will be really great if you make them, for all those reasons” that make Worthington a great leader, Rose said. “And we would get a couple points.”

Worthington rewarded Rose’s confidence with a couple swishes to give the Cougars the lead again with just more than three minutes remaining, and BYU held on to win the West Coast Conference quarterfinal 85-79 to keep its hopes alive for the league’s automatic bid in the NCAA Tournament.

“I felt relaxed,” Worthington said of his two big makes. “Those are the kinds of free throws you live for as a player, to be able to knock down some big-time shots. I went up there and said, ’I have shot a million of these in my lifetime, I’m going to knock them down.’”

Less than a minute later, Elijah Bryant went to the bench with his fifth foul — a curious call because Dalton Nixon was closer to Alex Floresca than Bryant was — and the Cougars were again in trouble. But with their leading scorer — Bryant finished with 27 points on 10-of-13 shooting — out of the game, TJ Haws made a basket and two free throws, Jahshire Hardnett hit two free throws, McKay Cannon broke loose on a press-breaker for a layup and Yoeli Childs finished it with two free throws and a dunk with two seconds remaining.

“I was proud of the way our group made plays and were able to finish off the game with a big win,” Rose said. “You knew that they were going to make a run back at us when we got up by 17. But you don’t think it is going to go all the way to where you are even again.”

The entire 17-point lead evaporated in less than nine minutes. A 71-59 BYU lead with 6:30 remaining was gone with 3:28 remaining when Carter finished a 10-0 run with his fourth 3-pointer. He had 20 points, while Isaiah Pineiro added 21 off the bench, including 10-of-11 shooting from the free-throw line.

Past BYU teams would have fizzled down the stretch in the face of a hostile crowd, but Worthington’s free throws righted the ship and Haws took over when Bryant became a spectator.

“I think we just trusted our concepts. We trusted each other,” said Childs, who had 22 points and eight boards. “We trust that we are going to make the right plays. We trust that we have that defensive mentality and that we are going to come back from any situation, no matter who has the momentum or what the score is. No matter if we are up, down, tied, we trust that we are going to make right play on both ends of the floor and tough it out and get the job done.”

And Rose trusted that Worthington would get it started. He said BYU’s big men finish every practice by taking 50 free throws, and the extra work paid off.

“It is repetition. It is confidence,” Rose said. “Luke knows how big those free throws are for our team at the end of games.”

The Cougars (23-9) will face the winner of the late Saint Mary’s-Pepperdine game in a semifinal on Monday, having advanced to the WCC’s Final Four for the fifth-straight year. San Diego fell to 18-13 despite the gritty effort it played without head coach Lamont Smith (placed on paid administrative leave after an alleged domestic violence incident) on the sidelines and can now only hope for an NIT bid after losing two of three games to BYU in 2018 and all four to league leaders Gonzaga and Saint Mary’s.

BYU 85, San Diego 79

• The Cougars blow a 17-point lead in an eight-minute stretch in the second half, but execute late and make their free throws to advance to the WCC semifinals for the fifth straight year.

• Elijah Bryant fouls out with 27 points on 10 of 13 shooting with just over two minutes remaining and BYU clinging to a 73-71 lead.

• TJ Haws, Luke Worthington, Yoeli Childs and Jahshire Hardnett combine to go 8 for 8 from the free-throw line in the final three minutes and five seconds