A man who stole vials of a powerful opioid at gunpoint from a Hudson Valley hospital was convicted on a host of charges but was acquitted of attempted murder of a cop.

On Wednesday in Ulster County Court, a jury convicted Joshua Stuart, 42, of Kerhonkson with two counts of robbery, two counts burglary and criminal possession. Stuart was acquitted of attempted murder of a police officer.

The charges stemmed from a series of violent crimes in the Town of Wawarsing in September of 2018.

On Sept. 28, 2018, Stuart of Kerhonkson allegedly entered the Ellenville Regional Hospital with a loaded handgun and forcibly stole numerous vials of drugs classified as opioids.

During the course of the robbery, he fired one shot from his gun inside the hospital, police say.

After fleeing the hospital, Stuart’s car was spotted in a wooded area off Cutler Road in Wawarsing. As the officers attempted to apprehend him Stuart fired several rounds from a 9MM handgun at officers and then fled into a large wooded area, officials say.

An intense manhunt ensued. Many local police agencies including the State Police, Ulster County Sheriff’s Office, DEP, the Ellenville Police Department and the Ulster County District Attorney’s Office searched for Stuart.

The next morning, Stuart is accused of burglarized a home on State Route 55, entering a second home looking to take a car and stealing from a third home.

While inside the third home, Stuart allegedly stole a purse and car keys and fled the property in the homeowner’s 2005 Honda Pilot.

The Honda Pilot was spotted in Brooklyn on Oct. 1. He was soon spotted near a Whole Foods Market in Brooklyn. Stuart attempted to flee into the Gowanus Canal and was captured shortly thereafter, police say.

Stuart is scheduled to be sentenced in Ulster County Court on Nov. 14.