WASHINGTON — The man who killed 12 people at the Washington Navy Yard 10 days ago left behind electronic documents saying that the government had been attacking his brain for the past three months using “extremely low frequency” electromagnetic waves created by the Navy, and that was the reason he needed to lash out, senior law enforcement officials said on Wednesday.

The documents provide the most detailed explanation to date for what investigators believe motivated the rampage by Aaron Alexis, a 34-year-old military contractor and former Navy reservist from Fort Worth who was killed in a shootout with the police at the navy yard.

“Ultra low frequency attack is what I’ve been subject to for the last three months,” Mr. Alexis wrote in one document found by investigators, Valerie Parlave, the assistant director in charge of the F.B.I.'s Washington field office, said at a news conference Wednesday.

“And to be perfectly honest, that is what has driven me to this,” Mr. Alexis wrote.

Mr. Alexis also said “he was prepared to die in the attack and accepted death as the inevitable consequence of his actions,” Ms. Parlave said. It is not clear whether he sent the documents to anyone.