Bam Margera says he was photographed with a drink in his hand at a Florida casino, and it was part of a domino effect that ended with cops giving him a ride to a rehab facility.
The "Jackass" star tells TMZ ... he had spent 140 days in a facility in Arizona for his manic bipolar disorder before being transferred to an outpatient facility in Florida.
Bam says he was taking daily outpatient classes in Florida, where he was staying with a friend and relative, and his wife and son were coming to visit him ... but when their flight was delayed, he started killing time at a casino.
BM says fans posted pictures of him with what appeared to be a drink in his hand, and he believes a panicked loved one saw the images and alerted law enforcement. That person also claimed Bam threatened to jump off a bridge ... something Bam says was a misunderstanding.
TMZ broke the story ... deputies responding to a call about an emotionally distressed person at the Don CeSar Resort Hotel in St. Pete Beach encountered Bam and gave him a ride to rehab in the back of a cop car. He was NOT arrested.
Bam says he's back in rehab for about 2 months ... and all he wants is to work on himself so he can see his son and get back to filming.