Bam Margera got a ride to a Florida rehab facility ... in the back of a police car.
Law enforcement sources tell TMZ ... deputies took the "Jackass" star to rehab after responding to a Sunday morning call about an emotionally distressed person at the Don CeSar Resort Hotel in St. Pete Beach.
When cops arrived, we're told deputies were given the heads up about a court order directing Bam to go to rehab, so police assisted. We're told Bam was NOT arrested and he doesn't have any pending charges.
Bam's unfortunately no stranger to rehab ... as we've reported, his life has been pretty turbulent lately, with his wife recently asking for custody of their 3-year-old son, Phoenix Wolf.
What's more, BM's also been booted from the fourth installment of the "Jackass" franchise and beefed with Johnny Knoxville and director Jeff Tremaine.
TMZ broke the story ... Bam says one of his earlier rehab stints made him feel like he was going to die from suicide or an overdose, and then he claimed he was getting help from a woman in Florida who's worked with famous folks like AC/DC's Brian Johnson and Steven Tyler.