Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A pastor and members of his congregation have been hailed as "heroes" for disarming an alleged gunman who police say attempted to kill his girlfriend and infant son inside an Alabama church.

Pastor Earl Carswell was shot and injured while subduing 26-year-old suspect James Junior Minter, who allegedly opened fire Sunday at the Oasis Tabernacle Church in Selma. Minter — whose girlfriend and 1-month-old son also were injured — fled the church but was later arrested not far away.

"There were several heroes in there," Lt. Curtis Muhannad, of the Selma Police Department, told reporters. "It takes a lot when you have someone with a firearm that's actually firing upon a person in a closed-quarters area, and you do whatever you can with regards to your own life to protect someone else's life."

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

James Junior Minter, 26, was charged with attempted murder after allegedly shooting his girlfriend, their infant son and a pastor during a church service. Selma Police Department

Members of the congregation said Minter walked into the church Sunday morning and sat down between his girlfriend and their infant son in the front row before pulling out a handgun and opening fire, according to the police statement.

The pastor and others in the church were able to subdue Minter before the suspect fled, police added. Minter was later captured by officers less than a mile from the church and arrested on suspicion of three counts of attempted murder, according to a statement from Selma Police Department.

Minter's 24-year-old girlfriend was shot in the shoulder and jaw and the couple's 1-month-old son was shot in the hand, police said. Carswell, 61, was shot in the leg while trying to grab the alleged shooter, police added.

Oasis Tabernacle in Selma, Alabama, where a man allegedly shot his girlfriend, his infant son and a pastor during a church service. WFSA

Minter's girlfriend and child have not been identified by police. Detectives were working on child visitation issues and domestic violence as a possible motive, according to the Selma Police Department.