BROOKLYN (PIX11) — A Brooklyn man was sentenced to 30 years in prison Wednesday for stabbing a police officer in the neck and shooting two others officers.

Dzenan Camovic, 23, pleaded guilty in March to three counts of aggravated assault on a police officer, in addition to a number of other charges. He attacked the officers because of his interest in and support for violent Islamist extremism, according to court filings.

“It’s a miracle none of these brave officers were killed when they were ambushed, stabbed, and shot by this brazen extremist,” Gonzalez said. “We have no tolerance for violence toward our law enforcement colleagues, and this long prison sentence holds him accountable for his depraved and unconscionable crimes.”

Camovic attacked on June 3, 2020. On that night, officers Yayon Frantz, Jean Pierre, and Randy Ramnarine were working an anti-looting post at the corner of Church and Flatbush avenues. Camovic approached from behind and stabbed Jean Pierre in the neck, officials said. He rushed at officer Ramnarine and threw the knife at him.

Jean Pierre fired at Camovic, and then tripped, prosecutors said. The two struggled for control of the gun. Camovic grabbed it and shot Ramnarine in the hand. He also fired at responding officers and shot one of them in the hand, too.

Camovic was also shot repeatedly. He was taken to a hospital and recovered from his injuries, officials said.

Former Attorney General William Barr said the attack was premeditated. He said Camovic had a “significant volume of materials” supporting Islamic materialism.

“We know that Camovic repeatedly yelled, ‘Allahu Akbar’ during his attack,” Barr said when Camovic was indicted.