VIRGINIA BEACH, Va. (WAVY) – The Virginia Beach Sheriff says the man accused of gunning down a pharmacist while trying to rob his business Monday stole the murder weapon from a local deputy.

Sheriff Ken Stolle told WAVY News’ Jason Marks the gun used by Walter Hubbard was stolen from the home of a deputy who knew Hubbard from church. The deputy is not facing any charges.

Walter Hubbard, photo courtesy Virginia Beach Police.

Court documents say Hubbard entered the deputy’s home around 9 a.m. Monday and took the gun and keys to the Honda CRV he used to drive to David’s Beach Pharmacy.

According to the warrant, the pharmacist, David Kilgore, refused to give Hubbard the oxycodone he demanded. Police say Hubbard shot Kilgore and went to a second pharmacy at 17th St. and Atlantic Avenue.

Police say at the second pharmacy, workers gave Hubbard the drugs he demanded. He fled and led officers on a 12-mile pursuit through the city.

Court documents say at least 17 shots were fired at police during the pursuit, which ended in a crash at the intersection of Witchduck Road and Virginia Beach Boulevard.

Hubbard appeared in a video arraignment in a Virginia Beach courtroom Tuesday afternoon and asked for a court-appointed attorney.

During court proceedings, the prosecution noted pending matters in Juvenile and Domestic Relations court. WAVY.com obtained those court documents for a protection order taken out by Hubbard’s wife in March.

“My spouse has a history of addiction to oxycodone and continues to use,” his wife wrote.

In court documents, she blames drugs for her husband’s violent outbursts.

On March 10th, Hubbard’s wife called Virginia Beach police to their home on Bernadotte Street. In court documents, she described Hubbard screaming shirtless in the front yard, throwing objects and hitting her. She noted his “unpredicatable behavior” and said she “[feared] for our safety.”

The next day, Hubbard’s wife and daughter filed for the protective order.

Two days later, court documents show Hubbard violated the order for the first time. Records show he violated protection orders again on March 20 and 21 — the last time saying he had been living in his truck and came home to shower.

WAVY.com also spoke to representatives at Hubbard’s former employer, AGI on International Parkway in Virginia Beach. Hubbard began working in the AGI factory in October 2013. A spokesperson said he twisted his knee in March, which resulted in a workers’ compensation case.

Court documents show Hubbard had knee surgery on March 17. AGI said he was cleared to come back to work in April, but never did, and he was dismissed.

The AGI spokesperson said Hubbard was never a problem at work and added Hubbard passed a drug test before he was hired.