SANTA CLARA, Calif. (AP)The San Francisco 49ers have traded running back Jeff Wilson Jr. to the Miami Dolphins for a fifth-round pick.

A person familiar with the details confirmed the teams made the deal before the trade deadline on Tuesday. The person spoke on condition of anonymity because the trade hadn’t been announced.

The Niners had a surplus at running back after trading for Christian McCaffrey last month and with Week 1 starter Elijah Mitchell set to return after the bye week from a knee injury.

So they managed to recoup a draft pick after trading away four of them for McCaffrey and reunited Wilson with Miami coach Mike McDaniel, who had been in charge of the running game in San Francisco for Wilson’s first four seasons in the NFL.

Wilson will team with former 49ers teammate Raheem Mostert in Miami’s backfield after the Dolphins traded Chase Edmonds in a package to Denver earlier Tuesday for pass rusher Bradley Chubb, according to another person speaking on condition of anonymity because that trade also hadn’t been announced.

Wilson has been a productive back when given the opportunity to play after entering the league as an undrafted free agent in 2018. He led the Niners in rushing with 600 yards in 2020 and had 92 carries for a team-high 468 yards and two TDs this year.

Wilson has averaged 84.1 yards from scrimmage in his 18 career starts in San Francisco.

But the Niners were going to have a hard time getting him the ball now that McCaffrey and Mitchell are both available.

San Francisco traded picks in the second, third and fourth rounds in 2023 and fifth round in 2024 to Carolina for McCaffrey less that two weeks ago. McCaffrey had 10 touches for 62 yards two days after arriving in San Francisco in his debut with the team Oct. 23 and then made a much bigger impact on Sunday.

McCaffrey had 18 carries for 94 yards, eight catches for 55 yards and threw a 34-yard TD pass. He became the fourth player since the merger to have a rushing, receiving and passing TD in the same game.

Mitchell went down with a knee injury in Week 1 following a productive rookie season when he rushed for 963 yards and five TDs.

AP Sports Writer Alanis Thames in Miami contributed to this report

AP NFL: https://apnews.com/hub/NFL and https://twitter.com/AP-NFL