Jonathan Martin, shown in 2015, posted a threatening image on Instagram last week. (Lynne Sladky/AP)

Jonathan Martin, the former Miami Dolphins and San Francisco 49ers offensive lineman whose frightening social media post shut down a Los Angeles-area school last week, has checked into a mental health facility, according to the South Florida Sun-Sentinel.

It is not known whether Martin’s decision was voluntary or involuntary. TMZ reported that Martin had a gun in his car when he was detained and that he is undergoing a psychiatric evaluation.

Martin had posted threatening comments last week that referenced two of his former NFL teammates and Harvard-Westlake, the private high school he attended, along with an image of a shotgun and shells. His Instagram story came a little more than a week after 17 people were shot to death in a Parkland, Fla., high school. Martin was detained Friday by Los Angeles police, according to the Los Angeles Times and ABC News, with the Times confirming that the Instagram account belonged to Martin.

“The investigation is continuing, but rest assured we believe there is no threat to any school in the L.A. area,” LAPD spokesperson Tony Im told USA Today on Friday.

Martin, who retired after the 2015 season with the 49ers, was a central figure in the Dolphins’ 2013 bullying scandal. An independent investigation found that players — including Richie Incognito and Mike Pouncey — and the team had fostered a hostile work environment that caused Martin to leave the team in the middle of the season. Incognito, who signed with the Buffalo Bills in 2015 after sitting out the 2014 season, maintained that Martin was just being hazed; the independent report indicated that Martin had been undergoing treatment for depression since he was a teenager.

The Instagram post that caused the Harvard-Westlake shutdown included the words: “when you’re a bully victim & a coward, your options are suicide, or revenge.” The Dolphins, Harvard-Westlake, Pouncey and Incognito and two other individuals were all mentioned in the post.

The report on the Dolphins found that Martin had been the victim of racist, sexually explicit, homophobic and misogynistic messages, and that his interactions with Incognito constituted “harassment.” Incognito was suspended for eight games by the league. Martin, who attended Stanford, was traded to San Francisco after the 2013 season and was waived after the next season. Although he was picked up by the Carolina Panthers, he retired with what he said was a back injury before 2015 training camps opened.

Martin, who graduated from Harvard-Westlake in 2008 and was elected to the school’s sports Hall of Fame in 2014, later revealed that he felt uncomfortable as a minority at the private school.

“You learn to tone down your size & blackness by becoming shy, introverted, friendly, so you won’t scare the little rich white kids or their parents,” he wrote in a Facebook post from 2015. “Neither black nor white people accept you because they don’t understand you. It takes away from your self-confidence, your self-worth, your sanity.”

Read more on the Dolphins’ scandal from The Post:

Jonathan Martin detained by police after Instagram post of shotgun

Scandal pulls back curtain on NFL locker-room dynamics

NFL report finds Richie Incognito, other Dolphins harassed Jonathan Martin

Read the full report (Warning: it is explicit)

Martin: “I felt trapped”

Incognito: “I’m not a racist”