TONAWANDA, N.Y. (WIVB) — A City of Tonawanda police detective is out of the hospital after being shot multiple times early Tuesday morning.

Det. David Ljiljanich, who is a detective, D.A.R.E. officer and 19-year veteran of the police force had been taken to ECMC after the shooting.

Erie County District Attorney John Flynn says the 44-year-old officer had seven wounds, but it’s not clear whether these were all separate gunshots, or entrance and exit wounds.

As part of the standard protocol, Ljiljanich was wearing a bulletproof vest when he was struck by gunfire. His vest took two of the shots, which struck him in the upper and lower body.

Ljiljanich’s vehicle was fired upon and other officers were shot at, too, Police Captain Fredric Foels revealed later in the morning.

Foels, who has been serving in Tonawanda for more than three decades, was there at the scene. After Ljiljanich had been shot, Foels says he moved him behind his cruiser.

Police say the situation began with a drive-by shooting on Morgan St. near Clinton around 1 a.m. That 32-year-old victim was shot in the stomach, and remains in intensive care at ECMC.

Hours later, after returning to the scene of the first shooting, police say that’s when Matthew Gerwitz, 28, opened fire on officers.

According to Foels, Gerwitz shot at them through a wall while leaving the apartment on Morgan St.

Police then chased him toward Kohler St. as gunfire continued. While the pursuit went on, they say Gerwitz threw a weapon into the grass. Eventually, police rammed his vehicle from behind and took him into custody.

A lieutenant with the police department broke his wrist during the crash. He’s receiving treatment at ECMC.

Police say the suspect, who is a Morgan St. resident, has had some previous run-ins with the law. On Wednesday morning, Gerwitz was arraigned on two counts of first-degree attempted murder, one count of second-degree attempted murder, and illegal weapons charges.

More charges could be coming, Flynn says. They include potential charges regarding assault and the discovery of materials used to make weapons inside Gerwitz’s home.

During a conference on Wednesday morning, Flynn said it appears Gerwitz used homemade firearms — a 9mm handgun in the first shooting, and an assault weapon against officers.

“It appears Gerwitz is a gun enthusiast who likes to make his own weapons,” Flynn stated.

He faces 25 years to life in prison if convicted. He will be back in court in June.