5:15 PM PT -- According to the Atlanta PD ... T-Pain's bodyguard was detained at the airport when a security checkpoint found a firearm in his backpack. He and the rapper were relocated to the Atlanta Police Airport Precinct to continue the investigation, where it was determined T-Pain was the rightful owner of the gun his bodyguard was carrying ... and he provided a valid permit to carry.
The gun was returned to the rapper, both men were released, and no charges were filed. However, we're told an investigation is ongoing to determine if the bodyguard will face charges for possession of a weapon at a TSA checkpoint.
T-Pain's carry-on luggage didn't make it onto the plane, because security agents found a gun in it ... TMZ has learned.
Law enforcement sources tell us ... the rapper's bag was flagged during a main checkpoint screening at the Atlanta airport Friday, and when TSA agents inspected it, they found a loaded Smith & Wesson .380 inside.
We're told cops were called ... removed the weapon, and took T-Pain aside for further investigation. It's unclear at this time if the rapper was arrested ... but he seemed to address the incident as it was happening on his social media.
Pain tweeted, "Might be a tad bit late today. Things at the Atlanta airport are getting........... eventful. @ Hartsfield-Jackson Atlanta International Airport."
He also shared a photo on Instagram with a similar caption, suggesting he was having a gun-related issue.
We've reached out to T-Pain ... so far, no word back.
Story developing ...