A man with a history of mental illness attacked three people over several hours in New York City Sunday before he was shot and wounded by police and arrested.

James Patrick Dillon, 23, was confronted by police in a backyard after they received a report of a burglary in progress at around 5:30 p.m. EST. The suspect had a knife and a beer bottle containing an accelerant, police said.

The officers ordered him to drop the knife, but he sprayed the unknown chemical onto the officers. They fired their weapons, wounding him.

Both officers suffered burns and were in stable condition. Dillon was hospitalized and has not yet been charged. It wasn't clear if Dillon had a lawyer.

The attacks began at about 11:30 a.m. Sunday in Queens when a 39-year-old woman was slashed in the face. Police say three hours later, a 55-year-old liquor store owner was stabbed to death, and a 61-year-old homeless man was set afire and critically injured.

The New York Post identified Dillon's first victim as Berta Carpio, one of his neighbor's. Carpio's husband, Jesus, told the paper Dillon threw a brick at his wife as he rode by on a bicycle, then attacked her with a knife. 

"I’m in so much pain. I’m really lucky to be alive,’’ Berta Carpio told the paper. “He could have killed me. He needs to be removed from society — far, far away from here."

At a press conference, police said Dillon had been treated for psychological problems in the past and that family members said he had not been taking his medication recently.

The Associated Press contributed to this report.

Click for more from The New York Post.