YNW Melly appears to have been the triggerman in the murders of his two friends ... at least according to a police detective who is set to testify at Melly's upcoming trial.
According to new legal docs, police detective Christopher Williams will be called by prosecutors as an expert witness, where he will tell the jury it was "more likely" Melly fired the fatal shots inside a car.
The detective, who says he has extensive training and expertise in reconstructing shootings, says his analysis shows it's a better bet Melly -- not co-defendant Cortlen Henry -- fired the fatal shots ... though he's not saying it with absolute certainty.
Remember ... when Melly and Henry were arrested and charged in the double murder of their friends, cops said their initial investigation determined Melly shot the men, and that he and Henry then staged the crime scene to look like a drive-by shooting.
Detective Williams says he reconstructed the shooting by looking at blood splatter and the angles of the bullet holes and gunshot wounds ... and it appears the shooter was seated in the backseat, behind the driver, and shot the victim from inside the car.
He also says the evidence shows the gun was fired no more than 8 inches from the victim's face.
YNW Melly, who is facing the death penalty, tried to have the detective excluded as an expert witness at trial, but the court denied his motion ... essentially saying testimony doesn't have to be 100% conclusive. Plus, the judge said Melly's attorneys got a chance to extensively cross-examine the detective about his findings and methodology.