Stockton, Calif. • BYU entered its West Coast Conference opener at Pacific having lost three straight games because of poorly played first halves.

Thursday night, a bad second half almost cost coach Dave Rose’s struggling team.

But the Cougars rallied after star forward Yoeli Childs fouled out with three minutes remaining and held off Pacific 90-87 at Spanos Center to improve to 1-0 in league play, 9-7 overall.

“We could have won that game a little bit easier, maybe a little bit prettier,” Rose said. “But I don’t remember a win where I have been more proud of our guys. Just so many things didn’t go our way.”

The Cougars almost gave the game away at the free-throw line, missing several down the stretch while the Tigers were making theirs in a foul-filled contest. Luke Worthington and Childs missed five free throws in the final four minutes -- three by Worthington and two by Childs — and Childs fouled out with three minutes remaining with 13 points and 12 rebounds.

But Jahshire Hardnett sank four free throws in the final 47 seconds and the Cougars escaped with the win, having lost 67-66 here last year. BYU was 23 of 34 from the free throw line, while Pacific was 31 of 38 in a game that featured 58 fouls.

“It was definitely frustrating, but it made us lock in as a team and force ourselves to grind it out,” said Hardnett, who was 8 of 9 from the line and finished with 17 points after not starting for the first time this season.

Rose benched Hardnett — the guard said it was because he picked up a technical foul against Mississippi State last week — but needed him late with Childs having fouled out.

“It was fine,” Hardnett said of the benching.

BYU was whistled for 31 fouls, Pacific 27.

“It was a real physical game, especially in the first half. Fifteen fouls for us. They were getting to the free-throw line it seemed like every possession,” Rose said. “They cut into that lead of ours with free throws.”

Zach Cameron hit a free throw with 3:12 remaining to give Pacific its first lead of the game, 79-78.

BYU regained the lead when TJ Haws hit an NBA-range 3-pointer with just under three minutes remaining. Worthington hit one of two free throws with 2:07 left to give BYU an 82-81 lead, and Zac Seljaas followed with a long two to make it 84-81 with 1:25 remaining. Then the Cougars hung on.

“I believe in this team that we can shoot lights out every game,” said Haws, who was 4 of 8 from deep, part of BYU’s 11-of-25 effort from beyond the arc.

Haws led BYU with 24 points and six assists, while Roberto Gallinat scored 21 of his team-high 22 points in the second half for Pacific. Gallinat and freshman Ajare Sanni missed free throws in the final 34 seconds.

“Especially coming off a couple tough losses in different games on the road, these guys showed a lot of heart and lot of guts and a lot of character,” Rose said of his squad, which plays at Saint Mary’s on Saturday. “There are things we can knit-pick with the game itself, but the outcome was good and I am just really proud of them.”

The Cougars opened the game like they would have no trouble winning in Stockton for the first time since a 62-47 victory in 2017.

Rose changed his starting lineup, going with seniors McKay Cannon and Worthington and bringing usual starters Hardnett and Seljaas off the bench.

Cannon rewarded the coach by sinking two 3-pointers before the first media timeout, then didn’t take another shot the rest of the game.

“There are a couple things going on. Some of them are health issues. I don’t really want to get into what is going on,” Rose said. “The most important thing for us, starting a new year, starting with confidence, was to just compete together as a group. Those two seniors, McKay and Luke, just helped us. … I just felt like the three days of practicing, and then coming over here, I wanted to have a different feel to our team, instead of feeling sorry for ourselves. Because that’s kinda where we have been.”

Dalton Nixon, who was cleared to play after missing the 103-81 loss at Mississippi State for personal reasons, made a dunk with 3:40 left in the half to give the Cougars a 46-25 lead.

But the Cougars faltered the last few minutes of the half and Pacific closed the half on a 12-3 run by getting several easy baskets off BYU turnovers and getting to the free-throw line frequently.

The Tigers were 14 of 17 from the line in the first half, BYU just 4 of 8.

“We knew they would make some runs,” Haws said. “I think we responded really well.”