FORT HOOD, Texas — A spontaneous argument among soldiers in the same transportation unit at Fort Hood, Texas, touched off the mass shooting in which Spec. Ivan Lopez killed four people, including himself, and wounded 16 others, Army officials said Friday.

Witnesses and relatives of the wounded said Lopez’s fury was apparently sparked by a simple dispute over paperwork. They said the 34-year-old military truck driver became exasperated after he walked into a human-resources office Wednesday afternoon and asked for a leave-of-absence application, but was told to come back the next day.

Lopez left, but returned moments later with a .45-caliber Smith & Wesson semi-automatic pistol and opened fire on soldiers in his unit, the 49th Transportation Battalion, killing two of them.

Lopez, a married father of four, then walked outside and indiscriminately shot at other soldiers, Army officials said. He sprayed bullets over an area the size of two city blocks, shooting people in two nearby buildings as well as from his vehicle before he was confronted by a military police officer in a parking lot.

The officer fired once at Lopez but missed. Before she could shoot again, he put his pistol to his head and squeezed the trigger, ending the four-minute rampage by taking his own life.

What was going through Lopez’s head before his outburst remains a mystery. Investigators said he left no explanation behind.

“We have not established a concrete motive, but we will do everything in our power to do so,” Christopher Grey, a spokesman for the Army Criminal Investigation Command, said at a news conference at Fort Hood. “Given that the alleged shooter is deceased, the possibility does exist that we may never know exactly why the alleged shooter did what he did.”

Lopez’s relatives also said they were baffled.

“My son must not have been in his right mind; he wasn’t like that,” Ivan Lopez Sr. said in a statement distributed by the family.

Lopez’s neighbors and relatives have said he was upset by his mother’s death in November and was frustrated that the Army had given him only a brief leave to return to Puerto Rico for her funeral. They described him as otherwise friendly and calm, if introverted, and dedicated to his family.

On Thursday, Lt. Gen. Mark Milley, the commanding general at Fort Hood, said the “fundamental, underlying causal factor” behind the shootings was Lopez’s “unstable psychiatric or psychological condition.”

On Friday, however, Milley downplayed Lopez’s psychiatric history, saying that “his underlying medical conditions are not a direct precipitating factor.” Instead, he said, the likely spark for the shootings was the argument that Lopez had gotten into with other soldiers in his unit.