EXCLUSIVE

Lil Pump was arrested Wednesday night at his home after he fired a gun, but the reason he discharged the weapon is in dispute ... TMZ has learned.

According to law enforcement, Pump's manager reported 3 men were jimmying the rapper's front door, trying to get into his San Fernando Valley home around 4 PM, and the suspects fired a gun once through the door. The manager was not at the house, but was relaying info to cops after speaking to Pump.

When police responded, they found a bullet hole in the front door. However, there were no suspects on the scene. Cops say the 17-year-old rapper had been smoking marijuana, and after talking to him they found holes in the intruder story.

Cops say the trajectory of the bullet hole shows it came from inside the home. Police returned a few hours later with a search warrant ... and found a handgun in the bushes below the balcony of Pump's apartment. The weapon was unloaded, but cops found ammo for the gun in the apartment. Cops felt Pump had fired the gun into the door -- not an intruder -- and arrested him for discharging a weapon in an inhabited place.

There's more potential trouble for Pump's family -- police found marijuana in the apartment, and his mother was not home. We're told she's under investigation for endangering a minor and having an unsecured gun at home.

Pump is currently being held in juvenile detention.