A man shot by police in Brooklyn Sunday night has been arrested and charged with stabbing his roommate in front of officers at the scene.

Police responded to a call of a fight at 110 Shepherd Avenue in Cypress Hills around 9 p.m.

They came upon a group of men in an apartment that police believe were roommates.

That's when polcie say 31-year-old Francis DeJesus grabbed a knife and began to attack his fellow roommate.

"He stabbed his roommate at least two times in both forearms, and began to chase his roommate as he tried to run away from him. Our officers gave commands to the male to drop the knife, and fired one time to protect the roommate who was being stabbed," said NYPD Assistant Chief Jeffrey Maddrey.

One round hit DeJesus in the torso.

Both he and the victim were taken to the hospital for treatment.

Police recovered a knife at the scene.

No officers were injured during the incident.

DeJesus now faces attempted murder and weapons possession charges.