DALLAS—Investigators believe that the young Army veteran who killed five police officers here Thursday had legally purchased the weapons he used either online or at a gun show, according to a law-enforcement official.

The official said Micah Xavier Johnson used an Izhmash-Saiga 5.45 mm high-powered rifle, a variation of an AK-style military weapon, in the attack.

Johnson also had with him a Glock 9mm semiautomatic pistol and a .25-caliber semiautomatic pistol, which were recovered at the crime scene, though it was unclear whether he fired them during the attack, the official said.

Investigators found two more rifles at the suburban Dallas home Johnson shared with his mother. They also found approximately 1 pound of Tannerite, a powder marketed to make exploding targets for gun practice, and a can of acetone, which can be used with other chemicals to make explosive material.

It was unclear when the gun purchases were made, the official said, noting that no prohibitions were placed on Johnson that would have prevented him from buying guns legally. The official added that Johnson was active on gun websites and discussed weapons in online chat rooms.