Aaron Alexis, the gunman in the Washington Navy Yard shooting rampage, didn’t just live with contradictions — he embodied them.

UPDATE: U.S. law enforcement officials are telling The Associated Press that the Navy contractor identified as the gunman in the mass shootings at the Washington Navy Yard had been suffering a host of serious mental issues, including paranoia and a sleep disorder. He also had been hearing voices in his head, the officials said.

A practicing Buddhist known by his friends as a peaceful soul, the 34-year-old Navy reservist at least once had succumbed to a “‘blackout’ fueled by anger,” according to a police report.

Defense officials speaking on background said he was working as an information technology contractor, but it was not immediately known which company employed him or whether he was assigned to the Navy Yard.

Later, computer company Hewlett-Packard issued a statement: “We are deeply saddened by today’s tragic events at the Washington Navy Yard. Our thoughts and sympathies are with all those who have been affected. Aaron Alexis was an employee of a company called ‘The Experts,’ a subcontractor to an HP Enterprise Services contract to refresh equipment used on the Navy Marine Corps Intranet (NMCI) network. HP is cooperating fully with law enforcement as requested.”

As a contractor, Alexis could have had a badge that might have gained him access to the secured naval base.

Meanwhile, Embry-Riddle Aeronautical University, which offers online courses in aviation and aerospace, confirmed that Alexis was enrolled as an online student via its Fort Worth campus, started classes in July 2012 and pursued a bachelor’s of science in aeronautics.

“We are cooperating fully with investigating officials,” the university said.

Born in Brooklyn, N.Y., Alexis joined the Navy Reserve in 2007. The circumstances of his departure from the Navy in 2011 were not disclosed by Navy officials. He achieved the rank of 3rd class petty officer as an aviation electrician’s mate.

His last duty station was Fleet Logistics Support Squadron (VR) 46 at Fort Worth.

Over the past 10 years, Alexis had at least two run-ins with law enforcement in which he possessed a firearm.

Court records from Tarrant County, Texas, indicate that he faced charges in 2010 for discharging a firearm through his apartment ceiling and into the apartment of a neighbor.

According to the incident report, Alexis told police he was cleaning his handgun when he accidentally fired a round but did not call police because he didn’t believe it went through his ceiling. The neighbor whose apartment was damaged by the gunshot said she previously got into a confrontation with Alexis because he claimed she was making too much noise in her apartment.

In 2004 in Seattle, police questioned Alexis after it was reported that he had shot out the tires of a construction worker’s truck in his neighborhood.

A police report says Alexis told police that he “didn’t remember pulling the trigger of his firearm until one hour later.” He described the incident as a “‘blackout’ fueled by anger.”

His father later told police that Alexis had been an active participant in rescue efforts during Sept. 11, 2001, terrorist attacks, and suffered from post-traumatic stress disorder.

After leaving the Reserves, Alexis worked as a waiter and delivery driver at the Happy Bowl Thai restaurant in White Settlement, a suburb of Fort Worth, said Afton Bradley, a former co-worker. The two overlapped for about eight months before Alexis left in May, Mr. Bradley said.

Having traveled to Thailand, Alexis learned some Thai and could speak to Thai customers in their native language.

“He was a very nice person,” Mr. Bradley said in a phone interview. “It kind of blows my mind away. I wouldn’t think anything bad at all.”

A former acquaintance, Oui Suthametewakul, said Alexis lived with him and his wife from August 2012 to May 2013 in Fort Worth, but that they had to part ways because he wasn’t paying his bills.

Alexis was a “nice guy,” Mr. Suthametewakul said, though he sometimes carried a gun and would frequently complain about being the victim of discrimination.

• Kristina Wong contributed to this article, which is based in part on wire service reports.