To prepare for his role as a cop in his new film “End of Watch,” Jake Gyllenhaal spent five months trailing active-duty Los Angeles Police Department officers. While many of his adoring fans would pay to spend that much intimate time with the actor, Gyllenhaal said the cops weren’t nearly as starstruck.

“They were definitely skeptical — it took us a while to become friends with the police officers that we were on ride-alongs with,” the 31-year-old said Monday night at the premiere of the film, which co-stars Michael Peña. “Let’s be honest: We’re something else to take care of in the back of that car. You start spending time with them every night, and that’s a big burden to put on the police officers.”

In the movie, which has generated largely positive reviews, Gyllenhaal and Peña star as partners whose bond deepens as they work the gritty streets of South Central L.A. The process of playing a cop altered Peña’s attitude toward the LAPD, the 36-year-old said.

“Before, I wondered who these people were: What’s their motive? Are they doing it for a paycheck?” Peña recalled. “But then I realize that ‘OK, these guys are the real deal,’ and they actually want to preserve the neighborhood.”

Both of the film’s leading men said they were seldom recognized while researching cop life — save for one instance when paparazzi got wind of the actors’ whereabouts as they were responding to a gang shooting.

“That was at the end of our whole experience, and the only time we were recognized because there were reporters filming a crime scene,” Gyllenhaal explained. “We felt bad, like, ‘Oh, man. We’ve been brought into this world, and what will the cops think now?’ ”

Still, after all of his training and research, Gyllenhaal doesn’t feel he could cut it as a LAPD officer.

“It’s our nature as actors to believe that we could, and that would probably get us into a lot of trouble,” he said with a smile.

Peña, however, feels a bit more confident about his chances.

“I definitely felt like a cop, and I definitely feel like I could do it,” he said. “For a while after shooting, I was still in the mentality and would use a different command voice, like, ‘Come here, sir.’ You use that voice and it stops people in their tracks.”