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

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

He...