HAMILTON, Ala. (AP) — A gunman fatally shot two people, one a former business partner, at a law firm and a nearby accountant's office in western Alabama on Wednesday morning, authorities said.

The suspect, 57-year-old Jimmy Cooper, was shot in the arm and leg before being taken into custody, Marion County District Attorney Jack Bostick said at a news conference.

Cooper faces two capital murder charges in the deaths of Donny Miller, 67, and Linda Cole, 61. Miller was Cooper's former business partner and Cooper was a client of Cole's, Bostick said.

Court records show Cooper had owned an insulation company and was ordered to pay more than $59,000 in a 2010 lawsuit. A lawsuit Miller filed in 2014, said that he, Cooper and Cooper's daughter had been partners in a foam insulation business. Miller had the lawsuit dismissed in June.

Police haven't released a motive in the shootings in Hamilton, a city of roughly 6,800 about 90 miles northwest of Birmingham. The district attorney says he plans to pursue the death penalty.

Sheriff Kevin Williams said deputies were at the county courthouse close to the scene when Cooper tried to flee. Deputies and police confronted Cooper, but it was unclear who shot him. Senior Trooper Johnathan Appling said in an emailed statement that a civilian assisted law enforcement officers. The State Bureau of Investigation is looking into the incident.

The sheriff said Cooper was apprehended behind a nearby bank after he was shot and had made it clear he wasn't going to surrender.

"He had full intentions of killing law enforcement or putting them in the situation where they had to protect themselves," Alabama Secretary of Law Enforcement Spencer Collier said.

"It's put everyone in shock," Bostick said. "Obviously, this is not something anyone ever anticipates or expects. I would say the entire community is just stunned at this point."

Cooper was taken to the University of Alabama at Birmingham Hospital with injuries that weren't life threatening. It was unclear whether he had an attorney.

Williams used the shooting as an opportunity to call for increased funding for mental health services.

The sheriff said one of Cooper's relatives signed a commitment order on him in July. He was taken to a behavioral health center in Jasper for an evaluation and was released, Williams said. The sheriff later added that authorities are investigating how Cooper got the handgun that was used in the shooting.

"It's certainly a problem; it's certainly something we need to address," Republican state Sen. Gerald Dial, chairman of the Alabama Senate Health and Human Services Committee, said of Williams' call for increased mental health services funding. "We've not done that as I would like to see it done in the past few years."

Too often, law enforcement is faced with handling suspects who are in need of mental health services, Williams said.

"We have a problem with mental patients with guns," Williams said. "Our problem in the state of Alabama — we have nowhere to put them. Our county jails are being flooded with mental patients that we legally can't really take care of; we're not trained fully."

A December 2015 report by the Treatment Advocacy Center said that despite the U.S. population doubling since the 1950s, the number of public psychiatric beds has dropped by more than 90 percent. The report also said severe mental illness is thought to be a factor in up to half of all deadly law enforcement encounters.