A gunman hijacked a public bus in Texas on Sunday morning, prompting an hourlong police chase through several cities and a shootout that wounded two officers and killed the gunman, the authorities said.

The gunman got on a Dallas Area Rapid Transit bus around 11 a.m., with one passenger already on board, in Richardson, Texas. Then the gunman opened fire, shattering several windows, and demanded that the driver keep driving, the transit agency said in a statement.

The gunman, whom the authorities later identified as Ramon Thomas Villagomez, did not give a specific destination for the bus driver or provide any explanation for his actions, said Gordon Shattles, a spokesman for the transit agency.

Mr. Villagomez, 31, was a suspect in the murder case of his girlfriend out of San Antonio and the aggravated assault with a deadly weapon of a relative out of Brazoria County, the authorities said.