This love triangle has four corners — and four police badges!

An NYPD sergeant cheated on his cop girlfriend with a fellow officer, whose husband is also on the job — and the bosses took away everyone’s guns so they wouldn’t kill each other, sources told The Post on Monday.

Sgt. Kandou Worley, 40, and Officer Stephanie Gallardo, 33, were both assigned to the department’s Strategic Response Group when they had their fling last year, according to an internal NYPD document.

But their secret was revealed when Worley’s live-in girlfriend, Tyeis Coppin, a union delegate in the 32nd Precinct, found incriminating photos on his cellphone.

One shows Gallardo, with her hair wet, gazing into the eyes of Worley, who has beads of water dotting his bare chest.

Others show Worley nuzzling Gallardo’s face and kissing her cheek, and Gallardo snuggling into Worley’s clothed chest while he caresses the back of her head.

In a fit of vengeance, Coppin, 41, allegedly posted the photos to Worley’s Instagram account, which bears the username “mike_lowry_78” — an apparent reference to the ladies-man detective played by Will Smith in the “Bad Boys” movie franchise.

Captions say “I told my girl I loved her 10 mins b4 I f–ked this one,” and “She’s someone’s wife, she’s not my girl tho. I have one and this is not her!!!!”

On the day after Christmas, Worley — who a source said served as Gallardo’s supervisor — warned her that the photos were online, and the NYPD learned about them two days later.

Gallardo was called in for questioning, and admitted that she and Worley had a “personal relationship” during September and October.

But Gallardo said that she’d been separated from her husband, fellow SRG cop Cristian Gallardo, 28, since March, even though they’re still living together and raising their 20-month-old daughter.

She also claimed “that with the exception of kissing while together off-duty on a number of occasions, the relationship [with Worley] was not intimate.”

The NYPD report says a total of nine handguns were seized from all four cops under a section of the Patrol Guide that permits impounding firearms in “non-disciplinary cases,” including those involving “stress as a result of family or other situations.”

A law-enforcement source said the circumstances raised “the potential for violent outcomes due to the sensitive nature of infidelity and everyone having access to guns.”

The Dec. 30 report also says the entire mess was turned over to the Special Operations Division Investigations Unit for further review, “including a review of social media.”

All four cops were given back their guns and returned to active duty in their original assignments during the past week, pending results of the SOD investigation, an NYPD spokesman said.

Lt. John Grimpel also said that the NYPD Patrol Guide doesn’t prohibit relationships between cops — even involving a superior and a subordinate — “except if you’re a police supervisor in the police academy.”

“Any police officer in the academy cannot have a relationship with a recruit in the academy,” Grimpel said.

Worley and Stephanie Gallardo both declined to comment when they answered the doors at their respective homes in Orange County on Monday afternoon.

Neither the Patrolmen’s Benevolent Association nor the Sergeants Benevolent Association returned messages.

Additional reporting by Allie Griffin