Veteran NFL assistant Chris Foerster resigned from his job in Miami in 2017 shortly after a video he made of himself snorting cocaine went viral. (Lynne Sladky/AP, File)

Almost two years ago, a lewd video surfaced of former Miami Dolphins offensive line coach Chris Foerster snorting a white powdery substance, which he later said was cocaine. The video went viral and quickly led to Foerster’s resignation, but the 57-year-old has found his way back into the NFL.

Foerster has been working in a consulting role with the San Francisco 49ers, according to ESPN. The hiring was never officially announced, and he does not appear on the team’s website.

Foerster and 49ers Coach Kyle Shanahan worked together for four seasons with the Redskins, from 2010 to 2014, Foerster as the offensive line coach and Shanahan as the offensive coordinator under his father, Mike. After leaving Washington, Foerster coached for one year in San Francisco before moving on to the Dolphins.

Shanahan spoke to NBC Sports about the hiring, saying the team hadn’t made Foerster involvement public because he’s only with the team in a consulting role.

“If he was fully on our coaching staff, going to practice and going to games, I understand that it’s something that I’d have to address, but he’s not,” Shanahan said. “He’s in a consulting role. A lot of teams have consultants. I understand the ramifications of that, and why people will ask why I didn’t say anything about it.”

Shanahan said Foerster returned to the franchise in a small role last year, “to help him with a job and make some money, and also because he’s good at it.” Foerster helped the team “from afar” with advanced scouting reports. The team agreed to give him a bigger consulting role this year.

“We are not going to act like flat out [the video] didn’t happen and just let him back in right away,” Shanahan said. “We are taking a very slow process, and that’s why we did the first year the way we did and why it led to the second year.”

Foerster has been coaching in the NFL since 1993, working stints with seven different teams.

The video originally surfaced on Oct. 9, 2017, and Foerster resigned later that same day. The short clip featured Foerster snorting lines of the substance and telling the intended recipient that he was about to go into a team meeting.

“How ‘bout me going into a meeting and doing this before I go?” he asked before a snort.

Foerster has received treatment for drug and alcohol addiction since the incident, something Shanahan cited in his defense of the hire.

“He did something extremely stupid, and since then, he has hit rock bottom,” Shanahan said. “He went to rehab for 60 days, and then he was in a 90-day outpatient rehab. For the last two years, he’s been in a 12-step program that he’s been to every single night seven days a week.”

Read more:

Brian Flores says he wasn’t trolling Kenny Stills with Jay-Z songs. He was challenging him.

Patriots’ Patrick Chung facing felony cocaine possession charge in New Hampshire

Former NFL player and his wife found fatally shot in their Minnesota home

U.S. trademark office sacks Tom Brady’s ‘Tom Terrific’ application