SANTA CLARA, Calif. -- Upon his hiring as the San Francisco 49ers' head coach in February of last year, one of Kyle Shanahan's first and most important tasks was finding a capable defensive coordinator.

For Shanahan, who cut his teeth in the NFL as an offensive coach, finding someone capable of acting as defensive CEO was of the utmost importance. That figured to be a difficult task, though, considering that many of the other newly hired head coaches had already filled their staffs.

The Niners kicked the tires on experienced coaches such as Gus Bradley, who took the Los Angeles Chargers' defensive coordinator job, and showed at least some level of interest in Chicago Bears defensive coordinator Vic Fangio. Meanwhile, new Rams coach Sean McVay scored one of the ultimate coups, landing Wade Phillips as his defensive coordinator. It was a move that essentially allowed McVay to turn the defense to Phillips and focus on what he knows best.

Under Robert Saleh, the Niners' defense made steady improvement in 2017. Robin Alam/Icon Sportswire

Alas, Shanahan had no such choices. After combing through some of the coaches he knew who could install the system he wanted, Shanahan landed on then-Jacksonville Jaguars linebackers coach Robert Saleh. Shanahan and Saleh had worked together with the Houston Texans when Saleh was a quality control coach.

"I always really respected how he worked," Shanahan said. "I thought he was always a very smart guy. I’ve kept in touch with him over the years and played against him a number of times. So I felt really good about it when I really sat and interviewed him right after the Super Bowl, talking to him over the phone, doing things like that. Through it all, I knew he had the, for lack of a better word, the type of brain I was looking for, just to be able to handle it all and the way he worked with people. I also knew he had a scheme that I really liked, that I thought he could add to and change a little bit."

Still, Saleh's lack of experience as a defensive coordinator left many wondering how he would fare in his first season on the job. Although there were some bumps along the way, Saleh quickly earned the respect of his players, and Shanahan walked away from the season feeling that his decision had been validated.

"Going through the year with him, he was everything I hoped for," Shanahan said. "He put in a very good scheme, adjusted it throughout the year to try to fit the players, still made adjustments, but also didn’t just give up on everything when it didn’t work. He had a foundation of what he believed in, and he stuck to a number of things. I think that’s one thing that allowed us to get better throughout the year. I think that’s one of the biggest challenges.

"Why is it so hard to lose that many games or to go 0-9? I said it with [GM] John [Lynch], when you’re struggling like that, everybody thinks you have to change everything you’re doing. ‘What are you going to change here? You’ve got to change this.’ It’s hard not to fall into that pressure because you’re 0-9. It’s hard to say, ‘No, it’s working.’ But when you do have people that are convicted, the right type of people who believe in each other and believe in something they stand for, Saleh is just like that. We were able to stick with what we believed in. I think it paid off in the long run.”

By the end of the season, Saleh's defense began showing signs of the type of fast, physical group he envisioned when he was hired. For the season, the numbers weren't exactly overwhelming, as San Francisco finished 24th in yards allowed per game (351.6), 16th in yards allowed per play (5.28) and 25th in points allowed per game (23.94).

But those numbers represented a step forward in all of those categories since 2016. That season, the Niners finished last in yards allowed (406.4), 29th in yards per play (5.9) and last in points allowed per game (30).

Those statistics also don't tell the whole story. After quarterback Jimmy Garoppolo took over as the starter in Week 13, the Niners' defense finally wasn't on the field for most of the game and was able to cut it loose and attack. During the final five weeks, the Niners ranked seventh in yards allowed (301.8), ninth in yards per play (4.96) and tied for ninth in points allowed per game (19.8).

Robert Saleh said that he liked how his Niners' defense played with "violence" late in the season, including in a win over the Texans in Week 14. AP Photo/Eric Christian Smith

After finishing as one of the worst run defenses in NFL history in 2016, the Niners improved to 22nd in rushing yards allowed per game (116.3) and seventh in yards allowed per rush (3.79). The jump was even more eye-popping in those final five weeks, when the Niners no longer found themselves trailing as teams ran the ball nonstop. From Week 13 on, the Niners were fourth in rushing yards allowed (87.2) and yards per rush (3.52).

All of those were steps in the right direction for the 49ers' defense, but Saleh recognizes that there is plenty of room for improvement heading into 2018.

"I don’t want to sound cliché, but you want to get better," Saleh said. "Continue to represent the style that we’ve come in, with the violence and the speed and ball hawking. The last half of the season was cool just in terms of our guys really understanding what it is to be a ball-hawking defense ... It’s about communicating so you’re on the same page so you can go faster. Then the violence -- our guys are playing with great violence. When you dissect it play by play and just watch tape, they’re playing with a level of violence, especially in the run game, that would make anyone in the league very happy. To continue to grow off of that and get better and provide a spark so the offense can, our offense is pretty good, and if you just give them the ball a few times, if you spark the stadium just a little bit, you could blow the doors open pretty quick. Overall, just continue to get better and continue to represent the style that we’re trying to create and the image that we’re trying to be on defense.”

Saleh hints that there will be some tweaks and adjustments going into next season, though he won't get into them. He does, however, acknowledge the importance of bolstering the outside pass rush and improving at cornerback. Saleh feels good about what the Niners have up the middle at defensive tackle, inside linebacker and safety.

But to take the next step, especially with a burgeoning offense, improving on the outside is paramount for Saleh's defense.

“The edges, your corners and your edge rushers are what get you off the field," Saleh said. "They’re the ones that get you off in two-minute. They’re the ones that win in the red zone. And so, from that regard, it is a domino effect. We get to third down very, very easily. We’ve built leads here over the second half of the year. Now we need to, as a defense, we need to learn how to close."