A Bronx man gloated on social media after a pair of gun-possession cases against him were recently tossed because one arresting cop was later killed by friendly fire and the other was busted for child porn.

“JUST BEAT 2 GUN CASES 💪🏿,” Ebrima Faal, 21, gloated on Facebook after the cases — in which he was facing several years behind bars — were dismissed on Oct. 30.

Faal was nabbed by Officer Brian Mulkeen on July 17 — a little more than two months before the seven-year veteran cop would be killed by two police bullets during a life-or-death struggle with a reputed gangbanger in the Bronx on Sept. 29.

Mulkeen, 33, nabbed Faal on Crotona Avenue and Garden Street in the Belmont section of the borough at around 12:15 a.m. after Faal was allegedly caught with a loaded .25-caliber semi-automatic, police said.

Faal was charged with criminal possession of a weapon and possession of marijuana in that case.

But the Bronx District Attorney’s Office tossed the case after Mulkeen was killed.

“In the case involving Mulkeen, we asked to dismiss, because we would not be able to prove the case beyond a reasonable doubt,” Bronx DA spokeswoman Patrice O’Shaughnessy said.

Faal was also busted on Feb. 1, 2018, by ex-NYPD officer John Telesca on Webster Avenue and Fordham Road in Fordham Manor and charged with criminal possession of a weapon for allegedly carrying a black .40-caliber Glock, authorities said.

Telesca, 37, was arrested at his Port Chester home in August for allegedly having and emailing dozens of pictures of naked children – some as young as 8, according to police.

He was charged with promoting and possessing obscene sexual performance of a child and suspended by the department without pay following the arrest.

Telesca, who was released on $5,000 bail after his arraignment in Port Chester Village Court, resigned from the NYPD sometime after, police said.

Law enforcement sources said that Faal’s gun case involving Telesca was thrown out as a result of Telesca’s arrest.

O’Shaughnessy confirmed to The Post Wednesday that the two gun cases against Faal were dismissed and sealed last month.

Meanwhile, Faal, who was again arrested in The Bronx on June 25 and charged with criminal sale and possession of marijuana, is slated to appear in court on that case in December.