The Saco man who shot and killed his wife and their three children at their home in July before fatally shooting himself in the head with a shotgun had been treated for anxiety and depression for several years and had stopped taking his medication several months before he committed the murders.

Joel Smith’s struggles with depression and other details concerning how the victims were killed, as well as the couple’s past troubles, were outlined in documents obtained Tuesday by the Portland Press Herald from the Office of Chief Medical Examiner in Augusta.

A report signed by Dr. Kristin G. Sweeney, an assistant medical examiner, provides details on how each member of Smith’s family was murdered before he committed suicide. Smith, 33, used a 12-gauge shotgun to shoot his wife, Heather Smith, 35, and their three children – his stepson, Jason Montez, 12, and his biological children, Noah Smith, 7, and Lily Smith, 4 – in their bedrooms.

The documents, which were first reported by the Bangor Daily News, also contain an investigative report from Saco police Officer Megan Tibbetts that describes what she found at the crime scene, an apartment building at 35 Water St., on the afternoon of Sunday, July 27.

Her report indicates that Smith most likely killed his family the night before, when neighbors described hearing what they thought were “fireworks” between 11 and 11:30 p.m. Tibbetts said Smith “was upset” that evening because his wife had stayed out until 10:30 p.m. socializing with neighbors.

According to Tibbetts’ report, the Smiths had been together for about 12 years and moved to Maine from Arizona four years ago.

The report says that Heather Smith had recently returned to the family’s home in Saco after undergoing six days of treatment for heroin addiction. As a result, the couple had been arguing a lot, and the couple’s children had been cared for by their paternal grandfather, a situation that Smith “had been depressed about,” Tibbetts said.

Smith had threatened suicide on Friday, July 25, according to Tibbetts.

Sweeney’s report, which was based on a review of Smith’s medical records and hospital visits, says that Smith saw a primary care provider on June 22, 2012, for “generalized anxiety, which had become intolerable around 2008 when he had significant financial difficulties due to job loss.”

Sweeney said Smith tried several different medications before settling on Citalopram, a drug that is typically prescribed for depression.

Sweeney said that Smith wanted to quit smoking. He also was diagnosed by an emergency room physician as having ulnar neuropathy in his right hand and was advised to rest.

On June 17, 2013, he visited the emergency room at Southern Maine Medical Center in Biddeford complaining of dizziness, ringing in his ears, hypertension caused by stress at home, chest tightness and a tingling sensation in his hands. He had recently started taking Zoloft, and was given a new prescription for Lorazepam.

Sweeney said that Smith last saw his primary care provider on Feb. 28, 2014. Sweeney said he had changed his medication at some point to Sertraline, but stopped taking the drug after he lost his insurance. Sweeney did not offer specifics but said Smith had not taken Sertraline for several months before the visit.

Smith reported that his anxiety had returned with “panic symptoms, obsessive worrying, and difficulty sleeping.” He was prescribed Sertraline again and was scheduled for a follow-up visit a month later but never returned to see a doctor after his February visit.