SANTA CLARA, Calif. (AP)Randy Gregory was back home in Colorado watching his new teammates on the San Francisco 49ers dismantle the Dallas Cowboys and was just salivating at the opportunity to be part of one of the NFL’s fiercest defenses and top teams.

Gregory’s career got a big jolt last week when he was traded away from a rebuilding team in Denver that featured the NFL’s worst defense to one of the league’s two remaining undefeated teams in the 49ers.

“I’ve always been a part of winning cultures all the way back to Pop Warner football,” he said Wednesday. “So not being in a winning culture was tough for me mentally, especially when I’m one of those guys they’re looking at to make plays out there. Being able to step in somewhere there is a winning culture and winning right now, obviously they’ve got a lot on the line and they’re seeing the big picture. For me I just want to slide in where I belong playing on a team like this.”

The 49ers view Gregory as a perfect fit as a bookend pass rusher who can add another threat opposite of last year’s Defensive Player of the Year Nick Bosa.

After serving four substance-abuse suspensions early in his career, including one that sidelined him for the entire 2019 season, Gregory has stayed out of trouble off the field since being reinstated in October 2020.

Gregory had a strong year in 2021, when he had six sacks in 12 games for Dallas and had four pressures in a playoff loss against San Francisco that caught the 49ers’ attention.

“I remember him tearing us up a little bit when we played him in ’21,” linebacker Fred Warner said. “He’s been a really good player for a long time. We’re always looking for guys to play on the D-line at a high level, so I think he’s going do well for us.”

Gregory turned that season into a five-year, $70 million contract from Denver in free agency in a move that never worked out, as he struggled with injuries and then got benched.

He ended up playing in 10 of a possible 21 games for Denver, collecting three sacks and undergoing two surgeries before being traded last week with a 2024 seventh-round pick to San Francisco for a 2024 sixth-rounder.

“You know how the NFL goes, I’ve been there for two years and had two new staffs,” Gregory said. “At the end of the day, I think there’s a lot of moving parts. … They’re probably in a state where they’re looking to rebuild with this new leadership. At the end of the day, ultimately I wasn’t part of that plan. I think it’s better that it happened this early in the season, kind of give me a new place and get acclimated.”

Gregory believes he will fit in better with the Niners system that will have him playing as a down lineman instead of a stand-up linebacker with the main job of getting up field to disrupt the running game or get after the passer.

Defensive line coach Kris Kocurek has had a good history of getting the best out of pass rushers and has already started working with Gregory before he even got on the field for his first practice with his new team on Wednesday.

“The biggest thing we’ve talked about the last couple of days is just getting my feet down and having the right stance and just being able to get up field,” Gregory said. “I think that’s what they do well, cause havoc and that’s what I plan on doing.”

NOTES: LG Aaron Banks (shoulder) was limited for practice and RB Elijah Mitchell (knee) did not practice. … LT Trent Williams and TE George Kittle got rest days. … LB Warner won the NFC Defensive Player of the Week.