WASHINGTON – The gunman who killed 12 people at the Washington Navy Yard on Monday began his rampage by heading directly to the fourth floor, where he shot people who worked with him, and authorities are investigating whether a workplace issue sparked the killings, according to law enforcement officials and witness accounts.

People in the department where Aaron Alexis was working had concerns about his job performance, and investigators are looking into whether those concerns escalated last week, the officials said.

“He was not doing a very good job, and somebody told him that there was a problem,” one law enforcement official said. “Our belief is that the people who were shot first were people he had issues with where he worked, people he had some sort of a dispute with. After that, it became random. … After the first shootings in that office, he moved around and shot people he came upon. They were then targets of opportunity.”

Alexis, a former Navy reservist who had recent problems with mental illness, was employed by a company contracted to upgrade computers at the Navy Yard.

Workers and law enforcement officials said Alexis worked on the fourth floor, where the shootings began. Although the investigators say they do not know the exact order in which the victims were shot, they said the rampage started in an area of people who would have worked with him.

The officials cautioned that they are still trying to learn more about the severity of the dispute and whether it was an impetus for the shootings.

The law enforcement officials spoke on the condition of anonymity because the investigation is in its early stages. Three of the officials said most of the victims on the fourth floor were shot at close range and in the head.

Investigators noted that the shootings began on the floor where Alexis worked and not in the open lobby or the top floor where he could have fired down into the atrium below.

“We’re attempting to understand as best we can his life up until the moment of that shooting, which would include trying to understand whether there were any issues related to work,” FBI Director James Comey said Thursday at a briefing with reporters.

Officials with The Experts, the subcontractor that employed Alexis, declined to comment through a spokesperson.

Meanwhile, an acquaintance of Alexis said that his company become so concerned over Alexis’ erratic behavior on a business trip that it ordered him home for a rest break last month and relayed its worries to his mother, according to a friend.

Melinda Downs, who became acquainted with the Washington Navy Yard shooter in Fort Worth, Texas, said Alexis told her that someone in the Human Resources Department of an Alexandria, Va.-based company had alerted his mother. Alexis expressed a measure of chagrin, she said.

“I can’t believe HR called my mom,” Downs said he told her.

But The Experts, a Hewlett-Packard subcontractor that had employed Alexis for about six months over the past year, called Alexis three days later, summoning him back to work the next day, Downs said.

The company’s concern, coming six weeks before the Navy Yard shooting provided another example of people noticing his bewildering behavior, yet doing nothing that might have prevented his progression to violence. It also raises questions about whether his behavior was so peculiar that either his employer or authorities should have intervened and prevented his reassignment to other Navy bases where he worked on computer systems. During a stay in Newport, R.I., employees of a hotel where he stayed had to juggle a succession of incidents that arose at a time when Alexis told police he was hearing voices, and knocking on the doors of other hotel guests trying to find the source of those voices.