Two people were fatally shot by police in separate incidents late Monday night, police said.

In the first incident, police were called to an apartment where a 35-year-old woman was locked in the bathroom with her two kids on Ocean Parkway in the Midwood area of Brooklyn at about 7:20 p.m. A 47-year-old man, who appeared to be her ex-boyfriend, was allegedly holding a knife, police said.

The man allegedly refused to drop the knife and he was fatally shot by police. A second 51-year-old man was also fatally shot after he entered the apartment. He appeared to be part of the incident, police said.

In a separate incident, police shot a man in the Bronx who allegedly ran at them with .22 caliber revolver at about 5:44 p.m. on Monday. Police watched the man allegedly firing his gun near the intersection of East 146th Street and College Avenue.

The man allegedly pointed his gun at one of the officers, police said, and his partner shot the suspect once in the elbow.

He was taken to Lincoln Hospital in stable condition, police said.