NYPD officers fatally wounded two men Tuesday night and early Wednesday in separate Brooklyn shootings about six hours apart, police said.

A .38-caliber revolver was recovered after officers shot and killed a man who had fired the weapon into a lounge about 3:40 a.m. Wednesday on Atlantic Avenue near Grand Avenue in Crown Heights, police said.

“He turned on the officers with the gun in his hand,” Chief of Patrol Terence Monahan said early Wednesday at the scene. He said the man did not fire at the officers.

The dead man was identified as Joshua Martino, 18, of Brooklyn.

About 9:45 p.m. Tuesday in Canarsie, officers shot a man who approached them with a knife after they responded to a call about an emotionally disturbed person in an apartment on East 99th Street, police said.

The man’s sister had called the NYPD and told them he was acting irrationally, police said. As the officers entered the building, according to the NYPD, the man, identified as James Owens, 63, grabbed a 13-inch knife from the kitchen and moved toward them.

advertisement | advertise on newsday

The two officers ordered him to drop the knife, but he refused, police said.

After one officer used a Taser and it failed to stop Owens, a second officer opened fire, police said.

Investigators are checking whether the Taser functioned properly, police said Wednesday, and a 13-inch knife was recovered from the scene.

Owens was pronounced dead at Brookdale University Hospital and Medical Center in Brooklyn, police said.

NYPD officers at scene on Atlantic Avenue near Grand Avenue in Crown Heights, Brooklyn, early Wednesday, Jan. 4, 2016, after officers fatally shot a man who had been firing a gun. Photo Credit: Theodore Parisienne

No police officer was injured in either incident.

“Luckily, all of our officers are safe,” Monahan said.

With Anthony DeStefano and Timothy Hughes