SANTA CLARA, Calif. -- Continuing what has become a tradition, the San Francisco 49ers and Detroit Lions agreed to a trade for the third consecutive preseason on Thursday, with the Niners sending linebacker Eli Harold to the Lions.

The 49ers will receive a conditional seventh-round pick in 2020 in return, a source confirmed to ESPN. MLive.com first reported the terms of the deal. The condition is that Harold has to be on the Lions' roster for four weeks, a source told ESPN's Adam Schefter.

Harold heads to Detroit after three mostly disappointing seasons in San Francisco. A 2015 third-round pick out of Virginia, Harold has played in all 48 games the past three seasons, including 23 as a starter over the past two.

Initially expected to provide edge rush help, Harold did not make much of an impact there, with five sacks in three years. Last season, Harold stepped into a different role as the Sam linebacker. Though he had just two sacks, he was solid in the run game, particularly as an edge setter in defensive coordinator Robert Saleh's attacking 4-3 scheme.

"It was a tough decision," 49ers coach Kyle Shanahan said. "We love Eli. It's been great getting to know him over the last year, but as this week went, just looking into, it's closer to how our final 53 is going to work out, and I won't say it was just about Eli; it has to do a lot with how we think we're going to use people on game day, who is going to be up between defensive linemen, outside linebackers, inside linebackers, and all three of those positions kind of play together."

With Harold's departure, all three 49ers who initially knelt in protest of social injustice during the national anthem are now gone from the team. Quarterback Colin Kaepernick opted out of his contract before the 2017 season, and safety Eric Reid became a free agent this offseason. Neither has signed with another team.

Before the Niners' first two preseason games, Harold has stood for the anthem. Asked about that decision Tuesday, Harold, who is scheduled to be an unrestricted free agent after the season, declined to speak about it.

"I understand why everyone would want to ask the questions, but I just don't want to get into that right now," Harold said. "I'm trying to focus on ball. Me and my wife had a discussion, and we feel it's best right now that I just don't answer those questions and try to stick to ball, if you don't mind."

Harold's departure means the 49ers will install a new starter at their Sam linebacker position. Shanahan said Mark Nzeocha would start there Saturday against the Indianapolis Colts. Pita Taumoepenu, Dekoda Watson, Cassius Marsh and rookie Fred Warner are other options, Shanahan said.

Warner, a third-round pick, has played primarily inside during the preseason but has the coverage ability and physicality to play Sam if needed.

In 2016, Lions general manager Bob Quinn traded Jeremy Kerley for offensive lineman Brandon Thomas. Kerley had 64 catches for 667 yards and three touchdowns that year. Thomas was mostly on the practice squad and is no longer with the Lions.

Last season, the Lions traded Laken Tomlinson to San Francisco for a 2019 fifth-round pick. While Tomlinson didn't work out in Detroit, the former first-round pick did well enough for the Niners to sign a three-year, $18 million extension this offseason after starting 15 games at left guard in 2017.

This time, the Lions are the team giving up a pick for a player at a position of need. Detroit's pass rush has been poor this preseason, not recording a sack. While Harold hasn't had much success in that regard, the team is hoping to jump-start his production.

The Lions also lost key linebacker reserve Steve Longa to a season-ending right ACL injury last week. Harold could compete for a starting spot in Detroit, as other than Devon Kennard and Jarrad Davis, no player has solidified a role within the linebacker corps. At worst, Harold could be a pass-rushing backup to Kennard -- a spot currently pretty open with two weeks to go in the preseason.

ESPN Lions reporter Michael Rothstein contributed to this report.