1:40 PM PT -- NBA's attorney, Jimmy Manasseh, tells us the rapper was only taken into custody because of his social media post ... and says NBA was the victim of an assassination attempt. Manasseh says NBA didn't have a weapon and didn't commit any crimes ... calling the whole thing a terrible and tragic incident.

NBA YoungBoy has been playing with fire on social media, and now -- in the wake of his Miami shooting incident -- he got burned, because cops arrested him for violating his probation.

Law enforcement sources tell TMZ ... the rapper was taken into custody immediately following a hearing in East Baton Rouge Friday, and he'll be detained for at least 30 days.

District Judge Bonnie Jackson ruled his involvement in the Miami fatal shooting last weekend, along with a social media post about it, constituted a probation violation -- even though he was the target, not the shooter.

Play video content 5/12/19 SWNS

As we reported, YoungBoy and his crew were shot at on Mother's Day outside the Trump Beach Resort near Miami, and at least one person was killed. We obtained video of the wild scene inside the hotel following the gunfire, in which the rapper rushes to the side of his GF, Kay Marie, who was hit by a bullet.

In the vid, YoungBoy's seen applying pressure to her wound as he and others try to get her to the hospital. She was eventually taken by ambulance after authorities pulled over the SUV they got in to leave the hotel.

Play video content 5/12/19 TMZ.com

The judge ordered the rapper detained Friday, citing the shooting and a social media post in which it appears YoungBoy talks about the shooting and threatens retaliation.

The post violates his probation from an August 2017 sentence for aggravated assault with a firearm. The judge put him on probation for 3 years after giving him a suspended 10-year prison term, and one of the conditions was that he stays off social media.

The thing is, YoungBoy's been all over social media prior to the shooting ... so, it doesn't appear he's been sticking the rules, anyway.

He's been arrested twice since then -- in Florida in 2018 and in Georgia earlier this year for weed and disorderly conduct.

We reached out to the rapper's team ... no word back so far.