The FBI released video of shooter Aaron Alexis walking inside Navy Yard with a gun on the day of the shooting. (Thomas LeGro/The Washington Post)

The government contractor who killed 12 people at the Washington Navy Yard last week was driven by delusions that he was being controlled by low-frequency radio waves and scratched the words “End the torment!” on the barrel of the shotgun he used, the FBI said Wednesday, offering new, chilling details of the attack.

Valerie Parlave, assistant director in charge of the FBI’s Washington Field Office, said that Aaron Alexis, 34, began the shooting knowing he would be killed. A search of Alexis’s electronic devices, she said, indicated that he was “prepared to die during the attack and that he accepted death as the inevitable consequence of his actions.”

Documents released Wednesday and details provided by authorities began to fill in some gaps in the timeline of the Sept. 16 rampage, which ended when police fatally shot Alexis in a third-floor cubicle.

The clues about Alexis’s mental state and motivations come from inscriptions found on his Remington 870 shotgun and documents found on his electronic devices.

In one document, he wrote: “An ultra low frequency attack is what I’ve been subject to for the last three months, and to be perfectly honest, that is what has driven me to this.”

Investigators are still trying to understand Alexis’s “pathway to violence,” Parlave told reporters. The etchings on his gun included “Not what y’all say!” and “Better off this way!”

Another scratched message, “My ELF weapon!,” and other evidence gathered from Alexis’s electronics indicate that the former Navy reservist thought he was being controlled by extremely low-frequency electromagnetic waves, according to the FBI. The Navy has legitimately used such technology, the FBI said, but these radio waves also have been at the center of conspiracies about government mind control.

Alexis had been working for The Experts, a subcontractor that was updating computer systems at Navy and Marine Corps installations. He arrived in the Washington area Aug. 25 and stayed at a hotel in Bethesda for a week, according to search warrant affidavits unsealed Wednesday.

From Aug. 31 through Sept. 7, he stayed at a hotel in Pentagon City, followed by a stay at a Residence Inn in Southwest Washington, where he remained until the attack. On Sept. 9, he started working on the fourth floor of Building 197 at the Navy Yard.

Parlave said that Alexis had a performance issue at work that was addressed Sept. 13 but that there is no indication that Alexis targeted “anyone he worked for or worked with.”

Parlave did not elaborate on the issue and stressed that investigators believe that Alexis fired at random. She said there was no evidence that any single event triggered the attack.

The day after the performance issue was discussed, the FBI said, Alexis purchased a Remington 870 shotgun in Virginia and went to a home-improvement store, buying items including a hacksaw. Police said the shotgun was sawed off at the barrel and stock.

According to the documents and an FBI statement, at 7:53 a.m. on Monday, Sept. 16, Alexis parked his Hertz rental car, a blue Toyota Prius, in Parking Garage 28, across from Building 197. He walked into the building at 8:08 a.m. with a backpack slung over his left shoulder. When he got to the fourth floor, Alexis — carrying the backpack as well as a clipboard — went into a men’s bathroom. He came out carrying a shotgun.

The backpack later was found hanging on the back of a stall door. It contained a roll of purple duct tape, empty boxes of ammunition, and numerous computer disks and software, according to FBI affidavits.

The documents do not detail the shootings, but a haunting 30-second video provided by the FBI shows some of Alexis’s actions. Dressed in a blue striped polo shirt and dark slacks with what appears to be an ID attached to his belt, Alexis stealthily stalks the hallways and a stairwell with his shotgun in hand, ducking behind walls when someone might spot him.

Police received a call reporting an “active shooter” about 8:17 a.m., the FBI said. Officers from Naval District Washington and the Naval Criminal Investigative Service were among the first to confront the gunman, authorities said. At least three D.C. police officers, some armed with only handguns, were inside before heavily armed tactical teams assembled and entered.

The three agents with the NCIS worked in Building 197, where they were assigned to investigate procurement fraud and offer counterintelligence support. Officials said they engaged in two firefights with the gunman in two sections of the sprawling building. Eight additional agents quickly joined them.

Quoting D.C. Police Chief Cathy L. Lanier, Parlave told reporters that the vast building was a “tactical nightmare” for first responders because of its numerous places for Alexis to take cover and hide.

Officials said it was NCIS agents who pulled a D.C. officer who was shot in the legs to safety and carried him down three flights of stairs and outside. The officer, Scott Williams, a 23-year veteran, was still at MedStar Washington Hospital Center on Wednesday but was expected to make a full recovery. Police also said that a second D.C. officer was hit twice in the chest but that his vest saved him from injury.

The shotgun was found on the first floor of Building 197, near the identification badge that had allowed Alexis access, court papers say.

Near Alexis’s body, authorities said, they found a 9mm semiautomatic pistol — which police have previously said was taken from a security guard he had killed in the first-floor lobby. The documents say the handgun was loaded, even after Alexis’s gunfire exchange in the final battle with police.

Among the items found inside the backpack were USB card readers, a USB memory stick, a copy of Microsoft Office, a DVD labeled “unclassified” and a disk for computer training. The affidavit does not say what authorities may have found on the computer disks or in the material. The FBI said they had also found other computer disks.