CUSHING, Maine — Andrew Kierstead told police he fired a shotgun repeatedly at his friend Richard Mills because the victim had hooked him on drugs, had been supplying him for 10 or 15 years, but then shut him off Thursday for not paying.

Kierstead, 40, of Tenants Harbor was arrested Thursday evening and charged with murder in connection with Mills’ death outside Mills’ home at 40 Far Meadow Lane in Cushing.

An affidavit containing details of what police say happened was filed Monday morning in Rockland District Court by Maine State Police Sgt. Jason Richards of the Major Crimes Unit.

Kierstead appeared in Rockland District Court on Monday afternoon where he was ordered by Judge Susan Sparaco to be held without bail. A hearing has been scheduled for Oct. 9 to determine whether there is probable cause to continue holding him without bail.

Story continues below advertisement.

Attorney Steven Peterson of Rockport represented Kierstead at the hearing. Outside the courthouse afterward, Peterson said that when he first visited Kierstead at Pen Bay Medical Center in Rockport on Saturday, his client was not in a good state of mind. The attorney said Kierstead’s medical condition appeared to better Monday.

Peterson said his client’s state of mind at the time of the shooting will be critical for the defense.

The suspect did not speak during the hearing, which lasted for less than five minutes.

Kierstead told police that after he shot Mills, he took pills with the intent to overdose, according to the affidavit.

“He later woke up and hoped it was a dream. He went outside and saw Mills and then called 911,” according to the affidavit.

Kierstead said he does not know when the shooting occurred. He called the Knox County Regional Communications Center about 8 p.m. Thursday from Mills’ home.

The Tenants Harbor man said he was an unemployed carpenter and had no money, according to the affidavit. He said Mills had supplied him with drugs after getting him hooked 10 or 15 years ago. Mills recently had fronted him $250 worth of pills but then on Thursday refused to give him more drugs until Kierstead paid off the debt.

“They argued and Kierstead got Mills to go outside and help him with a noise under the hood. When Mills was looking under the hood, Kierstead got a 12-gauge shotgun from the front seat and pointed it at Mills,” the affidavit from Richards stated.

Kierstead told police that he keeps the shotgun loaded and had been sleeping with it.

“Mills told him to put it away before someone got hurt. [Kierstead] then told them [officers] that he fired the shotgun at Mills. He pumped another round in and kept firing. He said he did not know how many shots he fired,” the affidavit stated.

Investigators said they found five 12-gauge casings near the truck. One gunshot hole was found in the truck.

Inside the residence, officers found a suicide note believed to have been written by Kierstead that explained why he shot Mills. The shotgun was found and so was one empty methadone pill bottle, one empty hydrocodone bottle, one hydrocodone bottle containing four tablets and one hydrocodone bottle containing 27 tablets.

The autopsy performed Friday by the Maine medical examiner’s office found four wounds to Mills’ front with 12-gauge slugs and one birdshot wound to his right buttock.

In a 911 call reviewed by state police, Kierstead allegedly told the dispatcher that he killed Mills over “f…ing drugs and sh..” He went on to say that Mills had “just totally f…ed up his life.”

Kierstead told state police Detectives Dean Jackson and Jason Andrews that he had been hooked on Percocet, Vicodin, methadone and other pills, according to the affidavit.

Lt. Kirk Guerrette and Detective Lt. Reggie Walker of the Knox County Sheriff’s Office were the first to arrive at the scene after Kierstead’s 911 call.

Kierstead has no recent criminal record. The only recent arrest in court records was November 2011 for failure to appear for a contempt hearing from small claims court over a $112 bill to Montgomery Oil. He later was fined in Rockland District Court for the failure to appear.