The handgun cops say was used to kill Tupac Shakur -- which mysteriously disappeared 11 years ago -- should be in the hands of the L.A. Sheriff's Dept. ... according to the detective who was on the case.
TMZ broke the story -- the .40 caliber Glock was found in a Compton backyard in 1998, and according to docs, LASD Detective Timothy Brennan was the guy who ordered the ballistic testing which revealed it was used in Tupac's murder.
Brennan, who's now retired, tells TMZ ... there should be NO mystery about where the gun is now ... IF everyone followed protocol. As Brennan recalls ... he gave the gun to ATF agents who conducted the testing. Once it came up a match, in a federal law enforcement database, he says ATF sent it to Las Vegas cops.
Now here's the rub. Brennan says law enforcement in Vegas didn't believe it was a match. He says he was never told why they reached that conclusion, but they rejected the weapon. Brennan says what should have happened next is the ATF to send it back to L.A.
As we reported ... the document dug up by producers of A&E's "Who Killed Tupac?" says a federal prosecutor recommended the gun NOT be turned over to Vegas -- but Brennan insists it was.
He thinks the handgun is still in the custody of L.A. authorities, but if it's not ... someone may be pulling something shady.