A man fleeing from a South Seneca credit union where he beat and robbed two tellers shot himself in the head, officials said Thursday.

At the same time the suspect shot himself, a deputy fired and wounded him in his upper back, Sedgwick County Sheriff Jeff Easter said.

The suspect in Wednesday’s robbery, identified by Easter as Horace L. Gwyn, 26, of Wichita, was out on a $100,000 bond in a District Court case, court records show. Gwyn was facing an April 15 trial on charges of aggravated assault, criminal discharge of a firearm and criminal possession of a firearm by a convicted felon. The charges accused him of firing a Ruger .40-caliber handgun at a woman in a car in the 1700 block of East Morris on Oct. 14, narrowly missing her, according to court records and a police report.

The Wichita Police Department lists Gwyn as a documented gang member, said Lt. Scott Heimerman. Gwyn had a conviction for an aggravated burglary committed in April 2005.

Based on the preliminary investigation of Wednesday’s robbery, it appears the suspect died from the head wound, Easter said.

Gwyn’s family couldn’t be reached for comment Thursday.

The deputy fired after seeing the robber with a handgun, after the suspect fired once at the deputy and, finally, after the suspect started to turn around, Easter said. The deputy, Easter said, feared for his safety and for others in the area where the shooting occurred, around the 1900 block of South Seneca. The area has a mix of homes and businesses, and Seneca is a busy street, Easter said. The deputy found himself in a situation “where his only option at that point was to fire his weapon” to stop the threat, the sheriff said.

Easter wouldn’t name the deputy involved but said he is a nine-year veteran.

Investigators recovered a .45-caliber semi-automatic handgun from the suspect.

Detectives will try to determine if Gwyn could be linked to other robberies, Wichita police Lt. Joe Schroeder said.

Easter and Schroeder gave this account: As a teller at the Credit Union of America at 1920 S. Seneca was in the process of opening the branch and was holding open a door for another employee, a masked man who had been hiding in a trash container rushed up, armed with a handgun. The employees tried to close the door on the gunman, but he immediately struck both women with his hands.

They went to a vault downstairs, where the robber got money; in the process, an alarm was triggered. The robber took the tellers back upstairs and took money from a teller station, then took the employees downstairs and bound them with duct tape and left them in the vault.

Both tellers suffered minor injuries; one of the women suffered a cut on her forehead that required stitches.

Meanwhile, the emergency dispatch system had received an alarm call at 7:22 a.m. A deputy at a Seneca substation, about 10 blocks north of the bank, drove to the rear of the bank, where he saw a man come out of the bank wearing dark clothing and gloves and carrying a handgun and backpack. The man ran north. The deputy began to pursue the suspect in his marked patrol car, and the suspect disappeared around a house. The deputy used his vehicle to block traffic on Seneca and followed the suspect on foot.

Although the deputy lost sight of the suspect, he knew he had a gun. The deputy saw the suspect again, still carrying a gun, and chased him. As the suspect crossed Seneca going to the west, he fired one shot at the deputy, and the deputy ordered the suspect to drop the gun and get down.

The deputy hesitated to shoot because of traffic around him on Seneca, Easter said.

The suspect held a gun under his chin as if he was going to shoot himself; as the deputy gave more commands, the suspect started to walk away, with the deputy walking after him.

The suspect raised the gun to the side of his head. After more commands from the deputy, the suspect started to turn, and the deputy fired five times, hitting the suspect once in the upper back from about 30 feet away.

Simultaneously, the suspect shot himself in the head. A coroner’s preliminary investigation indicates that the suspect suffered a close-contact wound to the head, Easter said.

Wichita police and the FBI are investigating the robbery, and the Sheriff’s Office is assisting the KBI in investigating the shooting, Easter said.

Evidence includes video that captured the robbery and the shooting.

Schroeder, the police lieutenant, said it is somewhat unusual for a bank robber to hit employees. “This was a pretty violent takeover,” he said. “This particular individual was pretty bent on violence.”

Police have investigated three robberies in Wichita so far this year, the same number as this time last year, Schroeder said. The city had 10 bank robberies in 2012 and 11 in 2011.

Gwyn, the suspect who died Wednesday, had been in and out of jail or prison since 2007 after probation or parole violations following his aggravated burglary conviction, Kansas Department of Corrections records show. His sentence ended in June 2011.