SANTA CLARA, Calif. -- The San Francisco 49ers selected running back Marcus Lattimore out of South Carolina with the second of their two fourth-round selections in the NFL draft Saturday.

Lattimore comes to the 49ers after a junior season during which he suffered a career-threatening right knee injury in South Carolina’s ninth game, one year after Lattimore suffered torn ligaments in his left knee midway through his sophomore season.

Despite the injuries, Lattimore still set South Carolina school records with 38 career rushing touchdowns and 41 total touchdowns in just 29 games. The NCAA’s Freshman of the Year in 2010, Lattimore rushed for 2,677 yards in three abbreviated seasons.

He will get an opportunity with the 49ers to add punch to a backfield that includes four-time Pro Bowl running back Frank Gore, who also had serious injuries to both knees in college but went on to become a star in the NFL. San Francisco’s top backup running back last year, Kendall Hunter, is coming off a torn Achilles tendon that ended his season last year after 11 games.