A Nassau County court officer died of an apparent self-inflicted gunshot wound after shooting his girlfriend in Brooklyn, sources said Saturday.

The NYPD said officers found the man in a fifth-floor Bushwick apartment Thursday night with a gunshot wound to his head and a 9-mm handgun near his body. He was pronounced dead at the scene, police said.

A 35-year-old woman was also found at the Forrest Street apartment with a gunshot wound to her head. Police said emergency responders took her to Elmhurst Hospital Center in Queens in critical but stable condition.

Officers found the couple while responding to a 911 call reporting an assault at the apartment about 10 p.m., the NYPD said.

Police have not released the man’s name.

He was identified by sources as Keith Allen, 49, a lieutenant in Nassau County Family Court in Westbury.

advertisement | advertise on newsday

The woman was identified by the sources as his girlfriend, Angela Rosa, a court clerk in Brooklyn who previously worked in Nassau.

Allen was a longtime resident of Merrick, and Rosa had recently lived in Merrick, according to public records. State records show Rosa worked as a court assistant in Nassau before being promoted to a senior court clerk in New York City Family Court in 2015.

Allen was named his union’s member of the month in September, according to the website of the Court Officers Benevolent Association of Nassau County. A posting on the website said Allen “is always trying to make someone’s day easier at the price of his own convenience” and “will always bend over backward to accommodate the needs of a fellow officer or court employee.”

With Kevin Deutsch