Instead of crossing their fingers after drafting Reuben Foster, the 49ers raised their hands in triumph.

In their draft room, where embedded sportswriter Peter King documented the scene last year, there were “shrieks” and “bro hugs” after the 49ers landed their third-ranked prospect with the No. 31 pick.

Screamed someone amid the chaos: “How about that s—!”

Was the outburst odd? It would have been to others in the NFL given Foster’s background.

For example, at least one team reportedly didn’t have Foster on its draft board due to what it called his “immaturity” and “issues with life skills.” And that was before the 2017 draft combine, where Foster failed a drug test and was kicked out of the event after a verbal altercation with a male hospital employee. According to another report, a wary team had crossed Foster off its list for another reason: the status of his surgically repaired right shoulder.

The first evidence of Foster’s poor decision-making was immediate: Two months after his failed combine drug test, he took the call from the 49ers at his draft party, which was sponsored by a tobacco and marijuana vaporizer company.

However, then-rookie general manager John Lynch didn’t have serious misgivings about Foster’s character or medical file: The 49ers were prepared to invest the No. 3 pick on the Alabama inside linebacker if their selection, Stanford defensive tackle Solomon Thomas, hadn’t been available.

“Had Solomon been gone, we’d have gone Reuben,” Lynch said in the draft room. “And been happy.”

Nineteen months after revealing that plan to King, Lynch spoke with reporters Nov. 25 in Tampa, Fla., three hours after releasing Foster. His 16-game tenure included three arrests — two on suspicion of domestic violence — and an assortment of injuries, including several issues with his right shoulder.

“We have to learn from the process,” Lynch said. “And we have. And we will. But at the same (time), you can’t play scared.”

Lynch meant the 49ers can’t let their experience with Foster prevent them from selecting another prospect with red flags.

So what can the 49ers learn that will allow them to take more educated draft risks in the future? And can they change anything to ensure a player with off-the-field issues receives better structure?

As for the latter question, it appears clear in hindsight that the 49ers were partly blinded by Foster’s immense talent and overestimated their ability to change him. As for the former, they might have learned something about the futility of providing structure to a troubled player prone to self-destructive behavior.

“I put my belief in him, and that hurts for me because I believed in the kid,” Lynch said Monday on KNBR. “I wanted him to be successful. I really thought I could help him in that. I thought the resources we put into him could help him.”

Foster was arrested Nov. 24 at the team hotel in Tampa on one count of first-degree misdemeanor domestic-violence battery. Police say Foster was involved in a verbal altercation with Elissa Ennis, his sporadic girlfriend for the past three years, during which he slapped her phone from her hand, pushed her in the “chest area” and slapped her across the face.

The incident occurred six months after Ennis, 28, recanted domestic-violence allegations against Foster that had led to his arrest in February in Los Gatos. Ennis testified in May that she lied to police as part of a “money scheme” and wanted to “end” Foster because she was angry after he broke up with her. She said she had stolen more than $8,000 in cash and two Rolex watches from Foster. She also testified about lying about domestic-violence charges in Louisiana after a boyfriend broke up with her in 2011.

A Santa Clara County Superior Court judge dropped the domestic-violence charges, but Foster didn’t emerge unscathed from his first NFL offseason. He served a two-game NFL suspension to start this season because of his arrest for misdemeanor marijuana possession in January in Tuscaloosa, Ala., and a gun charge that was part of his arrest in February.

Since Foster’s release, both Lynch and head coach Kyle Shanahan indicated they established guidelines for Foster to remain on the team after his two offseason arrests, but those didn’t include severing his volatile relationship with Ennis.

The 49ers didn’t think it was appropriate to demand Foster end a personal relationship. However, they did make it clear he would be released if there was another incident between the two, even if Foster was later exonerated. It’s not known whether a non-physical “domestic disturbance” involving Foster and Ennis in Santa Clara in October would have led to his exit. The 49ers have said they were unaware of the incident, which prompted a visit from police.

Foster had told the 49ers his relationship with Ennis wasn’t good for him. And Shanahan believed Foster’s turbulent offseason represented a “rock bottom” that would serve as Foster’s “wake-up call.” On Monday, Shanahan said it was incomprehensible to him that Foster brought Ennis to the team hotel.

“You’ve got to make sure that doesn’t happen again,” Shanahan said. “How can you do that? By continuing to be with that person … that’s not very good judgment. I believed what Reuben said, but for him to say that and then show the judgment that he did — I personally have a hard time relating to that and understanding how that could happen.”

Shanahan has said he’s never seen another organization provide the structure and resources to a player that the 49ers gave Foster. Many specifics of that support aren’t available due to privacy issues, but it’s common for NFL teams to make life coaches and mental-health resources available to players.

Director of player engagement Austin Moss had a deep relationship with Foster in which he spoke with him daily, either in person or on the phone. However, the team never considered a round-the-clock adviser for Foster.

During the regular season, Foster and Ennis, who lives in Baton Rouge, La., saw each other frequently in the Bay Area. So why didn’t the 49ers have more oversight on Foster off the field? Shanahan said the 49ers had a level of belief and trust in Foster.

“If you need to have a person live with someone every second,” Shanahan said, “then I don’t think you totally believe that person is what we believed Reuben was.”

The 49ers believed they could change Foster, who had a traumatic family background that included domestic violence. According to Roanoke, Ala., police reports, Foster’s father, Danny, shot his ex-girlfriend, Inita Berry Paige, and their 19-month-old son, Reuben, in November 1995. Law-enforcement officials say Danny Foster shot Paige in the back as she was holding Reuben, who also was wounded in the back. Shanahan said he’d never heard of an NFL player who had a worse childhood than the one Foster experienced.

Last year, the 49ers hosted Foster for a pre-draft visit. And they later sent team pastor Earl Smith and executive Keena Turner, then involved in their player-engagement department, to visit with Foster for two days in Tuscaloosa.

Since his release, Lynch has said Foster didn’t get into an inordinate amount of trouble at Alabama. Foster was present at a nightclub in 2016 during a triple homicide in which one of his friends was shot to death, but police said he was not involved. As a 49ers rookie, Foster and a teammate ran to safety after guns were pointed at them during an attempted robbery outside a San Francisco nightclub around 2 a.m.

“We sit in these draft meetings and you’d be shocked by the things you hear about players and how many times a certain player had been in trouble,” Lynch said on KNBR. “That wasn’t significant with Reuben.”

Alabama head coach Nick Saban, one of Foster’s staunchest supporters, acknowledged Foster would need significant structure in the NFL. Before the 2017 draft, Saban hinted to Sports Illustrated that Foster could be easily triggered. Saban said Foster would need people around him “with the ability to anticipate what’s happening, so you don’t get these emotional responses to things that are insignificant.”

Despite his issues, the 49ers anticipated getting a game-changing player in Foster, who while at Alabama won the Butkus Award given to the nation’s best linebacker.

Lynch, a hard-hitting safety during his decorated 15-year NFL career, was among those smitten by Foster’s physicality. Despite selecting Thomas with the No. 3 pick, both Lynch and Adam Peters, the team’s vice president of player personnel, termed Foster their favorite player in the draft. Lynch said he couldn’t suppress a smile when asked about Foster. Linebackers coach Johnny Holland termed him one of the best inside-linebacker prospects in the past 10 years.

Lynch said the 49ers had been drawn to Foster’s character.

“I’ll just be honest … he’s just my kind of player,” Lynch said on the day Foster was drafted. “He plays sideline-to-sideline and he’ll hit anything that moves. … He’s a really genuine young man. He’s got a smile that lights up a room, and the way he plays football’s special.”

Lynch told reporters that evening that the 49ers, who had the 34th pick, began calling teams who were drafting in the “early teens” in an effort to trade up for Foster. And the emotion involved in their extended pursuit explains why their draft room turned into a Mardi Gras celebration after they dealt a fourth-round pick to Seattle, moved up three spots and stopped Foster’s slide.

In mid-celebration, Lynch asked head athletic trainer Jeff Ferguson if there were concerns about Foster’s right shoulder. “What shoulder!” Ferguson yelled back and, as King wrote in his story, “more laughter ensues.”

Nineteen months later, that oft-repeated story is no longer amusing to the 49ers, who omit key details in the retelling of Foster’s draft day since his release.

Both Shanahan and Lynch have said the 49ers intentionally waited to take Foster until the penultimate pick of the first round because of his red flags.

“That’s why we waited and didn’t take him where we thought he was valued because we knew he was slipping and there were some risks,” Shanahan said. “Once he got to where he was (at No. 31), we felt good at that point at taking him.”

Said Lynch: “I think where we took him, we felt comfortable with it. Knowing that it was a risk.”

Both Lynch and Shanahan noted other teams were lined up to take Foster at the end of the first round. However, it was the 49ers who would have been comfortable taking Foster at No. 3 and were willing to surrender draft picks to trade up for him.

So are Lynch and Shanahan’s comments an attempt to save face, or a case of amnesia?

Whatever the case, if the 49ers want to learn from their experience with Foster, they need to answer this: What led them to place so much belief in a player they still don’t really know?

“I do believe in his heart,” Shanahan said. “I have (believed). I hope I’m not wrong on that. Shame on me if I am.”

Eric Branch is a San Francisco Chronicle staff writer. Email: ebranch@sfchronicle.com Twitter: @Eric_Branch