It's a good thing Lionel Messi's rich -- 'cause the soccer superstar was gambling away some of his cash ... hours before he was ordered to fork over roughly $2 MILLION in a tax fraud case.
TMZ Sports obtained pics and spoke with witnesses who saw Messi hitting the roulette table and playing some blackjack at the Atlantis Resort in the Bahamas.
We're told Messi was in good spirits -- but didn't want to be approached while gambling.
Before he hit the casino floor, Messi was spotted at dinner at the resort with a man who appears to be his father.
Waiting for your permission to load the Instagram Media.
What's interesting ... Messi's dad was also convicted in the tax fraud scheme in Spain and was ordered to pay roughly $1.5 million in fines.
FYI, the Barcelona player and his dad were found guilty on 3 counts of tax fraud for using tax havens in Belize and Uruguay to conceal earnings from image rights.
We're told Messi didn't appear to be drinking at the casino -- but did smoke a ton of cigarettes.
Messi has been at the resort for a few days -- taking pics with fans and relaxing by the beach.