The family of Brian Mulkeen, the NYPD officer who died in a friendly-fire tragedy last month, penned a heartfelt letter thanking their “NYPD family” for its “outpouring of love and support,” The Post has learned.

Police Commissioner James O’Neill shared what he called a “touching letter” from the Mulkeen family in a department-wide email last week.

“From helping us to process this devastating loss to assembling the incredibly noble services honoring Brian’s life and legacy, we cannot thank you enough for being by our side through it all,” the family’s note read. “Please know that we too stand by your side and that you will always have our love, support and gratitude.”

The letter extends a “special appreciation” to the Patrol Borough Bronx Anti-Crime Unit, where Mulkeen was assigned.

“We recognized your efforts, both seen and unseen, and are tremendously grateful for the depth of your compassion,” the note said.

Mulkeen, a member of the NYPD for 6½ years, was killed amid a violent struggle with a reputed gangbanger who was reaching for the officer’s service weapon in the Bronx on Sept. 29.

His family’s message concluded with a tribute to the fallen 33-year-old.

“Brian made an honorable choice to join the NYPD. We all know how and why. Like everything he did in his life, he strived to be among the best of the best,” it said. “Brian was truly doing what he loved to do, with all of you, by selflessly and passionately serving and protecting others.

“He is a hero. You are all heroes. Be strong, be safe and keep Brian in your hearts forever. He will forever be watching over us all.”

Mulkeen’s death was the second friendly-fire tragedy this year. Detective Brian Simonsen was accidentally killed in February while responding to a Queens robbery.

In an exclusive interview with The Post after Mulkeen’s fatal shooting, Simonsen’s widow, Leanne Simonsen, slammed the NYPD for contributing to a “trigger-happy” culture.

“Let me just start with, it’s the perp’s fault no matter what. I’m not blaming the NYPD,” she said. “But do I feel like [police brass] need to do something. Training? Absolutely.”