A man with an AK-47 assault rifle opened fire in a historic town square Thursday, killing his ex-wife and a bystander in a rampage prompted by a child support dispute. The gunman was later killed.

Four people were wounded, including the gunman's son and three law officers.

The gunman, 43-year-old David Hernandez Arroyo Sr. (search), was shot in the melee outside the county courthouse before fleeing the scene. He fired at officers through the rear window of his pickup truck in a chase that lasted several miles, Tyler Police Chief Gary Swindle said.

Authorities believe he may have been shot through the window during the pursuit. He was pronounced dead on arrival at a hospital.

Police said the firefight began after Arroyo, wearing a flak jacket and bulletproof vest, confronted his ex-wife and adult son on the courthouse steps about a proceeding involving unpaid child support.

Law enforcement officers responded from inside the courthouse and confronted Arroyo, who is believed to have shot 50 rounds.

"We ran to the window and saw him shooting over and over and over again," said Julie Carnahan, a 57-year-old court clerk who had just returned from lunch at the time of the shooting. "It was the most horrible thing I ever saw."

Margo Adkins, a deputy court clerk, said everyone rushed to the window after hearing a popping sound. She said she saw a gunman, who appeared to be heavyset and in his 40s or 50s, and two officers down.

"The man who was down was holding up his hand like, 'Don't shoot me, or stop.' He was holding his hand out like 'don't shoot' because he and another deputy were shot," she said.

The victims were identified as ex-wife Maribel Estrada, 41, and Mark Wilson, 52, a bystander with a concealed weapons permit who had tried to help. Estrada and Arroyo divorced a year ago after 22 years of marriage.

The ex-husband had a history of spousal abuse and weapons violations, and apparently was irate over the divorce.

"He definitely came well-armed and prepared. We do understand there had been some threats made by him the previous week," Swindle said.

Smith County Sheriff's Deputy Sherman Dollison, 28, was in critical condition at East Texas Medical Center (search) after being shot four times. The man's son, David Hernandez Arroyo Jr., was shot in the legs and was in fair condition.

A sheriff's lieutenant and a Tyler police detective were treated and released.

Tyler is a city of about 86,000 located about 95 miles east of Dallas.

Tyler calls itself the "Rose Capital of the Nation (search)" and attracts about 100,000 visitors each October to the Texas Rose Festival.