Jonathan Martin, in an interview with NBC’s Tony Dungy late last year. (Courtesy NBC)

Jonathan Martin got a shot at a fresh start in the NFL when the Miami Dolphins traded the offensive tackle at the heart of the Miami Dolphins’ locker-room harassment scandal to the San Francisco 49ers on Tuesday night, just hours after NFL free agency began.

The move will reunite Martin, 24, with the man who coached him at Stanford, Jim Harbaugh, and gives him probably his best chance at succeeding in the league. In exchange for Martin, the Dolphins will receive a conditional draft pick that would be a seventh-rounder in 2015 if Martin makes the 53-man roster next summer. Martin, who is from Northern California, was thrilled with the news, quickly changing his Twitter background to the 49ers’ logo and tweeted that it was “a great day.”

After an independent investigation found that Martin was subjected to a pattern of harassment in the locker room by the Dolphins’ Richie Incognito, John Jerry and Mike Pouncey, it became clear that it was in the best interests of Martin and the Dolphins to make a move. Owner Stephen Ross was instrumental in the trade, the Miami Herald reports, and wanted to send Martin to the right place for him. “We feel that this move is in the best interests of all parties involved,” Dolphins General Manager Dennis Hickey said (via the Herald). “We wish Jonathan well.”

Harbaugh was interviewed by Ted Wells, the man who led the NFL investigation into the bullying allegations that Martin said drove him into such a deep depression that he considered suicide.

“[Harbaugh] told us that he had never doubted Martin’s tenacity, work ethic and dedication to the game, and that he had never seen Martin exhibit problems with social adjustment,” Wells’s report stated. “Coach Harbaugh told us he believed that Martin likely could continue to have a successful career in the NFL. It appears that Martin was up to the challenge of dealing with physical or verbal intimidation by opposing players during NFL games, but fell victim, at least in part, to persistent taunting from his own teammates.”

Martin was a second-round pick out of Stanford in 2012 and left the Dolphins on Oct. 28, when the Dolphins’ locker-room situation came to light.