Nicki Minaj's new boyfriend wasn't just convicted of attempted rape -- he also went to prison for killing a guy ... and now we know the story behind his manslaughter conviction.
Law enforcement sources tell TMZ ... Nicki's new man, Kenneth Petty, rolled up on Lamont Robinson one early morning in April 2002 and opened fire on him on a street corner in Queens, NY.
We're told Petty drove to the crime scene with a group of cohorts, hopped out of the car, walked across the street where Robinson was hanging out, pulled out a gun ... and shot him in the stomach 3 times. Our sources say he then fled in the vehicle with the group.
We're told police who investigated the crime at the time did not believe robbery was a motive -- they suspected it to be a targeted hit over a gang beef. One investigator who was on the OG case told us he could only recall the shooting was over some "bulls***."
According to court docs, obtained by TMZ, Lamont -- who only survived for a short time -- ID'd Kenneth in a photo lineup when police went to question him in the hospital. The docs say he nodded his head to confirm Kenneth had shot him, as he couldn't speak. He died soon afterward.
Kenneth was initially charged with 2nd-degree murder, but pled guilty to a lesser charge of 1st-degree manslaughter. He served 7 years in prison, and got released in 2013.
As we reported ... Nicki's beau also did nearly 4 years behind bars after being convicted of attempted rape as a 16-year-old about a decade prior.
Like we've told you, Nicki isn't fazed by Kenneth's checkered past ... as we're told, she and Kenneth have already discussed having babies and getting hitched.
She certainly doesn't seem to be shying away from their love either ... privately or in public. Nicki's been plastering pics of her and Kenneth all over social media.