Call it the era of good feeling between the FBI and the NYPD.

After 12 years of tension under former Commissioner Ray Kelly, the relationship between the NYPD and the FBI is now friendly. How long that lasts depends on whether the men at the top can submerge their law enforcement egos for the greater good.

Kelly was unable to do that. Today, the signs of cooperation between the bureau and the NYPD are everywhere. During last year’s Chelsea bombings, William Sweeney, the low-key head of the bureau’s NYC office, was permitted to take the lead at a Police Plaza news conference hosted by another low-key guy, Commissioner James O’Neill, then in his first week in office.

Cooperation was evident again last month during the lower Manhattan fatal terror truck attack. After a beat cop wounded suspect Sayfullo Saipov, the NYPD hustled him to a hospital for questioning. By nightfall, the FBI had filed federal charges.

In fact, one of the investigators, praised for his work on the case by Acting U.S. Attorney Joon Kim, was George Corey, an ex- NYPD anti-terrorism detective now working with the feds.

In 2004, Corey was sent to London as part of a Joint Terrorist Task Force team after the arrest of radical Muslim cleric Abu Hamza al Masri. At an NYC news conference, Kelly singled out Corey for praise.

The NYPD released his picture and provided enough details about him so that reporters turned up at his home. His frightened wife contacted police headquarters. Corey was brought home from London, supposedly for “security reasons.”

Meanwhile, an FBI spokesman said, “In 24 years of the JTTF, I can’t recall a JTTF investigator having his photo published in the midst of a prosecution.” And Pasquale D’Amuro, then head of the FBI’s New York office, said of Kelly’s news conference: “This is NOT the way do we do business.”

Things changed in 2014 with Kelly’s departure and William Bratton’s appointment. Bratton appointed former TV newsman John Miller — who had served as head of counter-terrorism under Bratton in Los Angeles, assistant director of the FBI in Washington and deputy associate director of National Intelligence — NYPDs’ deputy commissioner for counter-terrorism.

“The institutional animus has gone,” Miller said of the current relationship between the NYPD and FBI. “The tone is set at the top and for the past four years the tone has been different.”