The NYPD’s Internal Affairs Bureau is investigating how two cops frisked a turnstile jumper and somehow missed the loaded handgun tucked in his waistband, law-enforcement sources said Friday.

Police body-camera footage obtained by The Post shows the moment NYPD cops frisked a turnstile jumper who was packing heat — and somehow missed the loaded handgun tucked in his waistband.

The footage shows 37-year-old ex-con Billy Walters being patted down by officers inside the 149th Street-Grand Concourse subway station in the Bronx on Tuesday.

A latex glove-wearing cop searches up and down Walters’ legs, going through his pockets and inspecting around his waist area without ever finding the .45 Sig Sauer. It was only discovered on Walters when the cops brought him in front of a desk sergeant.

The officers stopped Walters after they spotted him slipping through an emergency subway gate at the station without paying the fare around 11:45 a.m., police have said.

Cops cuffed him at the scene before marching him over to the Transit District 11 substation near Yankee Stadium, authorities said.

At the substation, video shows the cops again searching Walters as he attempts to explain that he was running late for a court date.

“I was going to Burnside. I had to be there by 12. I changed my clothes. I took a shower at my people’s house and then I was going down to court,” Walters can be heard saying as the second search of him is being conducted.

One of the arresting officers is seen in the video pulling up Walters’ shirt inside the substation, exposing a handgun in Walters’ waistband.

Seconds later, officers are seen removing the handgun.

“While at the police facility, a secondary, more thorough search incidental to lawful arrest was conducted, where an illegal firearm was recovered from the perpetrator,” the NYPD said in a statement.

Walters, who is homeless, was charged with criminal possession of a weapon and menacing after police eventually found the gun.

He also was charged with possession of marijuana after a shopping bag filled with 36 smaller baggies of weed was discovered on him.