The military veteran who killed three law enforcement officers in Baton Rouge last summer left behind a suicide note, a prayer from an Islamic holy book and an online trail of his rage against police.

Two days after a white police officer shot and killed a black man in Louisiana’s capital, Gavin Long searched the internet for addresses, phone numbers and other personal information belonging to the two officers involved in the July 5 shooting of Alton Sterling, a prosecutor’s report revealed Friday.

Less than two weeks later, the 29-year-old black man from Kansas City, Mo., traveled to Baton Rouge and ambushed law enforcement officers outside a convenience store and car wash near police headquarters.

Armed with a semi-automatic rifle that he legally purchased, Long fatally shot three officers and wounded three others on July 17 before tactical officers killed him, ending a gun battle that lasted nearly 14 minutes that Sunday morning.

East Baton Rouge Parish District Attorney Hillar Moore III said there’s no evidence that Long acted on any information he obtained about the two officers who struggled with Sterling before one of them shot and killed him outside a convenience store. Moore also said there’s no indication that Long had any support from anyone in Baton Rouge or attended any of the nightly protests there after Sterling’s death.

“He believes that protests are worthless and that action needs to be taken, not protests,” Moore said.

Police found a suicide note in Long’s rental car. He wrote that people who knew him would be surprised he was “suspected of committing such horrendous acts of violence” but that he believed he had to inflict harm “upon bad cops as well as good cops in hopes that the good cops (which are the majority) will be able to stand together and enact justice and punishment against bad cops.”

He also left a printout in his car from an Islamic holy book that was mostly in Arabic.

FBI agents and Louisiana State Police investigators traced Long’s movements in the days leading up to the attack. They learned he arrived in Baton Rouge on July 12 and checked in and out of four different hotel rooms during his brief visit.

“We believe that he was ready to die this day,” Moore said.