BOULDER, Colo. (AP) — All those yellow flags had Colorado coach Mike MacIntyre seeing a little red.

Understandable.

Isaiah Oliver returned a punt 68 yards for a score with 5:27 remaining and No. 21 Colorado overcame eight personal-foul penalties to beat UCLA 20-10 on Thursday night.

"You're going to have a game like that every once in a while," MacIntyre said. "But not with the selfish penalties we had. We'll fix that."

Oliver caught the punt on the right side of the field, cut back to the left and went untouched for the decisive score. It was the first punt return for a TD in 11 years for Colorado (7-2, 5-1 Pac-12, No. 15 CFP) and came on a night when the Buffaloes struggled to get much going.

The game featured a combined 25 penalties for 224 yards, two blocked kicks and five turnovers — four by Colorado. UCLA (3-6, 1-5) has dropped four straight.

"Couldn't get anything going on offense and had some trouble on special teams. That's a good team and when that happens it's tough to win," UCLA coach Jim Mora said.

The Buffaloes struggled to control their temper and were called for taunting, roughing the passer, unsportsmanlike conduct and a targeting call that led to the ejection of outside linebacker Jimmie Gilbert early in the first quarter.

MacIntyre vowed to make his team run laps for all those personal fouls.

Really, though, the team gets the message.

"If you want to be Pac-12 championship team you can't be doing that stuff," senior QB Sefo Liufau said. "As a group, as a team, we can't let other people get under our skin. Ultimately, we'll end up hurting ourselves and hurting our chances."

UCLA quarterback Mike Fafaul stepped in with Josh Rosen sidelined by a shoulder injury. He finished 15 of 29 for 185 yards and one TD. He also threw an interception.

"Colorado has a great defense," Fafaul said.

Liufau went a school-record 152 attempts without throwing an interception before tossing two in a span of six passes. Later, the senior fumbled on a big hit by Takkarist McKinley and was helped off the field. Freshman Steven Montez briefly took over.

Colorado finished with 304 yards of offense but struggled to put points on the board for a second straight game.

"We've got to go back and correct stuff," tailback Phillip Lindsay said.

THE TAKEAWAY

UCLA: The Bruins were held to 25 yards rushing, well below their season average (85.5). They need to win out to become bowl eligible.

Colorado: They have a game lead in the Pac-12 South race over USC and Utah. Two of their final three games are at home.

POLL IMPLICATIONS

It's hard to see Colorado moving up very much given the way the team played. Better to win ugly than not at all.

RISING UP

There was a section of the stands lined with flip cards that spelled out "The Rise ." That's the Buffaloes' mantra this season as they try to transform a once downtrodden program.

"They are a very exciting story not just in our conference but nationally, just to see the way the program has developed for them," Pac-12 Commissioner Larry Scott said.

KICKING ISSUES

Third-string Colorado kicker Chris Graham connected on a 37-yarder with 13:40 left to give the Buffaloes a 13-10 lead. He also hit a 21-yard field goal that was tipped at the line but still got through. He had another blocked.

Colorado has kicker issues with Davis Price out because of mono and Diego Gonzalez done for the season after tearing his Achilles tendon.

The Bruins fared no better on field goals, missing two kicks and having another blocked.

This & That

Among those attending the game included: Broncos boss John Elway and approximately 32 NFL scouts representing 21 teams. ... Lindsay had 11 catches for 76 yards, along with 73 yards rushing. He scored on a 1-yard run in the first quarter. His 11 catches were a team record for a running back. ...It was Colorado's first win over UCLA since joining the Pac-12 in 2011. ... Fafaul said after the game that Rosen is bracing for surgery. "It's tough for him," Fafaul said.

UP NEXT

UCLA: Host Oregon State, a team the Bruins beat 41-0 last season. UCLA holds a 42-16-4 advantage in the series.

Colorado: At Arizona. The Buffaloes led 24-17 going into the fourth quarter a year ago, only to see the Wildcats rally for three late scores.

___

More AP college football: www.collegefootball.ap.org