SANTA CLARA -- Robert Saleh will return for his third season as the 49ers' defensive coordinator, coach Kyle Shanahan said Monday.

The 49ers' defense ranked 13th in the NFL in total yards allowed, but the unit fell short in points allowed, ranking 28th in the league, and turnovers generated. In fact, the 49ers’ seven takeaways on the season were the fewest in NFL history -- as was their two interceptions.

“Saleh has done a good job, and I think he’ll get better,” Shanahan said one day after the 49ers closed a 4-12 season with a 48-32 loss to the Los Angeles Rams.

Shanahan said he doesn't foresee making any changes to his coaching staff.

“I like our staff a lot," he said. "I think we have some good coaches. I think there’s areas we can all get better in.”

Shanahan quipped he'd always keep an open mind as far as improving his coaching staff if the opportunity presented itself.

“If Bill Belichick became available two weeks from now and said he wants to come here, and I was told I had to let someone go to bring him in, it would probably be a smart decision to do that,” he said.

In 2016, the 49ers had one of the worst run defenses in NFL history. They allowed 2,654 rushing yards, a 4.8-yard average, and 25 touchdowns on the ground.

This year, in Saleh's second season in charge, the unit ranked 14th in run defense, allowing 1,814 yards, a 4.1-yard average, and 13 rushing TDs.


“I’m with him every day, so I know how good of a coach he is,” Shanahan said of Saleh. “I know how he is schematically. I know how he is in dealing with players. I know what he can handle with his personality and how smart he is.

“I also know he took over a 32nd-ranked defense, and we went from one of the worst defenses stopping the run in the history of football to being a pretty sound defense versus the run.”

Shanahan pointed out that the 49ers also used eight different safeties and didn't find consistency with their two inside linebackers. Rookie Fred Warner was a fixture for the entire season, but veteran Reuben Foster was released before the Week 12 game against the Buccaneers after his arrest at the team hotel in Tampa, Fla., on a domestic violence charge.

[RELATED: NFL mock drafts have 49ers taking an edge rusher at No. 2]

The 49ers struggled with their tackling early in the season, and Shanahan said the emphasis on generating turnovers might have led to that. Later, the tackling improved, but the takeaways never came. The 49ers head into the offseason with edge rusher as the team's biggest need.

49ers general manager John Lynch, appearing with Shanahan at the season-ending press conference, said he believes the defense found some clarity on its line with the roles for Arik Armstead and Solomon Thomas.

"What I’m excited about, I think we’ve grown much closer to finding out who we are as a defense, the identity,” Lynch said. “That takes some time. Once you have that, you can do everything a lot better. You can find players to fit that a lot better, and I’m very encouraged about that, as Kyle is.”