Two men have been hailed as heroes for their part in stopping the worst mass shooting in Texas, which left at least 26 people dead.

The attacker, identified in US media as Devin Kelley, opened fire after entering the Sutherland Springs First Baptist Church in Wilson County.

As the massacre unfolded, the shooter was confronted by an armed resident who "grabbed his rifle and engaged that suspect," according to Freeman Martin, a regional director of the Texas Department of Safety.

Johnnie Langendorff pursued the man who attacked the Sutherland Springs First Baptist Church (ZUMA/REX/Shutterstock)

The unidentified man was helped by another local resident, Johnnie Lagendorff, who told KSAT TV he was driving past the church as the shooting happened.

"I saw two men exchanging gunfire, the other being the citizen of the community. The shooter of the church had taken off, fled in his vehicle, the other gentleman came and said we need to pursue him. And that’s what I did, I just acted."

He said he did not know the armed resident who had exchanged fire with the gunman: “He was just a member of the community and he came to my vehicle in distress with his weapon. He explained very quickly what happened. He got into the truck and I knew that it was time to go.”

Texas church shooting Show all 9 1 /9 Texas church shooting Texas church shooting The site of the mass shooting at First Baptist Church in Sutherland Springs, Texas Reuters Texas church shooting First responders are at the scene of shooting at the First Baptist Church Reuters Texas church shooting Enrique and Gabby Garcia watch investigators at the scene of the mass shooting AP Texas church shooting Law enforcement officials investigate the scene at the First Baptist Church in Sutherland Springs, Texas Reuters Texas church shooting Carrie Matula embraces a woman after a fatal shooting at the First Baptist Church in Sutherland Springs Associated Press Texas church shooting Law enforcement officials gather near the First Baptist Church Getty Images Texas church shooting Community members come together for a candlelight vigil for the victims of the deadly church shooting in Sutherland Springs Laura Skelding/AP Texas church shooting Mourners participate in the candlelight vigil held for the victims Jay Janner/Austin American-Statesman via AP Texas church shooting A vehicle is hauled onto a flatbed truck where the suspect in a deadly church shooting was found dead in Guadalupe County William Luther/Austin American-Statesman via AP

Mr Langendorff said the gunman eventually lost control of his vehicle and crashed.

He said the other man walked up to the vehicle with his gun drawn and the suspect did not move.

They stayed there for at least five minutes, until police arrived.

"It was strictly just acting on what's the right thing to do," Mr Langendorff said.