EXCLUSIVE

Ben Affleck's blackjack days are over ... at least at the Hard Rock in Vegas -- because he was just banned FOR LIFE from playing the game at the casino ... after security says they caught him counting cards.

Affleck was in Sin City earlier this week with wife Jennifer Garner. We're told he planned the Vegas trip as a romantic getaway before he ships off to Detroit for several months to shoot his new Batman movie.

But things took an unromantic turn Tuesday night -- Hard Rock casino sources tell us, Affleck was playing blackjack at a high rollers' table when security swarmed.

According to sources, security informed Affleck he had been deemed an "advantaged player" and was no longer allowed to play blackjack at the Hard Rock. We're told security had spotted Affleck counting cards ... a gambling strategy that involves counting card values to decrease betting risk.

Counting cards isn't technically illegal, but it can get you kicked out of a casino -- which is exactly what happened to Affleck. We're told security arranged for a car service to take him back to his hotel.