(CNN) The Louisiana police officers who fatally shot a black man pinned to the ground did so after seeing the man reach for a gun, a Baton Rouge detective said.
Alton Sterling's death helped spur nationwide protests against excessive force by police. He was shot outside a convenience store after police responded to a call about a man threatening another man with a gun.
In a search warrant affidavit seeking surveillance video from the store, Detective R. Cook wrote that the Baton Rouge officers deployed their Tasers after Sterling did not comply with their orders.
"While the officers were attempting to subdue the subject the officers observed the butt of a gun in the subject's front pants pocket," Cook wrote.
"When the subject attempted to reach for the gun from his pockets the officers fired their police issued duty weapon at the subject to stop the threat. The subject was shot multiple times and did not survive his injuries."
CNN obtained the search warrant affidavit after the owner of the convenience store, Abdullah Muflahi, sued Baton Rouge and its police department. Muflahi accused authorities of illegally taking him into custody and confiscating his entire security system without a warrant.
When asked about the lawsuit by CNN, Cpl. L'Jean McKneely said police would not comment on pending litigation, as is standard procedure.
The U.S. Department of Justice is leading a criminal investigation, Louisiana Gov. John Bel Edwards said. The FBI and state police also will be involved, and a federal civil rights investigation will be conducted.
Was Alton Sterling killing justified? Depends what officers were thinking
Any consideration of state charges would come after the results of the federal investigation, East Baton Rouge District Attorney Hillar C. Moore said.
Moore recused himself and his office from the case on Monday, citing a possible conflict of interest.
"It is my determination as district attorney that given the history of a long and close working relationship with the parents of one of the officers involved in this shooting, there would always be questions of my partiality," Moore said.
He said the state attorney general could accept the case himself, appoint another district attorney or choose an independent prosecutor.
The deaths of Sterling and Philando Castile -- both of whom were shot and killed by police -- touched off massive protests in the United States.
During one of those protests Thursday in Dallas, Micah Xavier Johnson killed five Dallas police officers who were helping protect the protesters.
During his hours-long standoff with police, Johnson said he was ready to kill more cops with bombs, Dallas Police Chief David Brown told CNN.
"We had negotiated with him for about two hours, and he just basically lied to us -- playing games, laughing at us, singing, asking how many (police officers) did he get and that he wanted to kill some more and that there were bombs there," Brown said.
A search of the gunman's home revealed he had supplies to make explosives. Brown said police found bomb-making materials and a journal that suggested Johnson had been practicing detonations and appeared ready to take aim at larger targets.
It was enough, Brown said, to have "devastating effects on our city."
But other law enforcement sources said Johnson had a "small quantity" of the binary explosive components of Tannerite. Tannerite is a name-brand explosive generally used for long-range rifle target practice, when the shooter needs visual confirmation that a distant target has been hit.
Other materials that could have been used for bomb-making were also discovered, but none of the material was assembled, a law enforcement source with knowledge of the investigation said.
Among the legal materials found, the source said, was a can of acetone, two canning jars of black powder (often used for reloading ammunition), some hobby fuse and three feet of PVC pipe.
"He was possibly planning other explosives, but there was a heavy lean toward Tannerite and exploding targets," a federal law enforcement official explained.
Investigators have learned that Johnson liked to "explode targets" by shooting at them, the official said.
Law enforcement officials say the FBI began looking into Tannerite several years ago when it became apparent domestic terrorists were interested in using it for sinister purposes. But Tannerite is difficult to turn into a weapon and more difficult than other explosives to detonate, the sources said.
A day before Johnson opened fire on police, the African American Defense League called for action after Sterling's death.
"The Pig has shot and killed Alton Sterling in Baton Rouge, Louisiana!" the group's Facebook post said. "You and I know what we must do and I don't mean marching, making a lot of noise, or attending conventions. We must "Rally The Troops!" It is time to visit Louisiana and hold a barbeque. The highlight of our occasion will be to sprinkle Pigs Blood!"
The group also issued and then quickly deleted another post Thursday, "calling on the gangs across the nation! Attack everything in blue..."
Johnson "liked" the group's page. He also had visited the websites of the Nation of Islam and the Black Riders Liberation Party -- which the Southern Poverty Law Center considers to be hate groups.
Tom Fuentes, a former associate director with the FBI, said the messages and the groups behind them should be treated the same way the federal government investigates ISIS.
"It's no different than the ISIS propaganda that goes out," Fuentes said. "And the question for law enforcement is, where do you draw the line between free speech and something else? If a message is espousing someone to take action, even if they inspire one guy to strike out, isn't that enough?"
Dallas detectives are reviewing more than 300 statements from witnesses and officers from the scene, Brown said.
Police have 170 hours of body camera footage to download and analyze, the chief said.
But many questions remain, including the meaning of the letters "RB." The killer wrote those letters twice on a wall -- using his own blood -- before he was killed by a police bomb, Brown said.
Johnson was wearing a bulletproof vest and had three weapons on his body, a law enforcement source familiar with the investigation said.
Those weapons included a Glock 19 Gen4 pistol, a Fraser .25-caliber handgun and an Izhmash Saiga 5.45-caliber semiautomatic, assault-style rifle.
A second law enforcement official said it appears all the weapons were purchased legally, and that some were bought online.
The killings of five officers came as a horrific shock to Johnson's parents -- especially because the Army veteran had wanted to be an officer when he was younger, his mother said.
"He loved his country," Delphine Johnson said in an interview with The Blaze. "He wanted to protect his country."
But his demeanor and attitude changed drastically after his six-year military service, which included seven months in Afghanistan, Johnson's mother told The Blaze. She said he morphed from a gregarious extrovert to a "hermit."
The gunman's father, James Johnson, said his son started delving into black history after he was honorably discharged last year. But he said he had no clue what his son would do.
"I don't know what to say to anybody to make anything better. I didn't see it coming," James Johnson told The Blaze. "I love my son with all my heart. I hate what he did."
In Minnesota, relatives of Philando Castile are trying to understand why an officer killed the school nutrition services supervisor during a traffic stop. Castile's fiancée broadcast the aftermath of the shooting on Facebook Live.
"He let the officer know that he had a firearm and he was reaching for his wallet and the officer just shot him in his arm," Diamond Reynolds said in her Facebook broadcast. "... You shot four bullets into him, sir. He was just getting his license and registration, sir."
On Tuesday, Judge Glenda Hatchett of the TV court show "Judge Hatchett" announced she will represent the Castile family in civil matters. Hatchett said she plans to file a civil suit, but is not ready to release details yet.
As for the criminal investigation, Hatchett called for an independent prosecutor.
St. Anthony police don't have body cameras, office manager Kim Brazil said. The investigation is ongoing.
Tom Kelly, a lawyer for Jeronimo Yanez -- the officer involved in the fatal shooting -- told CNN that Castile matched the description of a suspect involved in an armed robbery. Kelly said that suspect description "aroused in Officer Yanez a reasonable suspicion to take further investigative steps leading to the stop of the vehicle."
But Castile's mother said there was no justification for the killing of her son, who would have turned 33 this Saturday.
"I am devastated, but I have to get a message out. He is the driving force in me to make sure this doesn't happen to another mother," Valerie Castile said.
"My son was a humanitarian. He was a pillar in this community. The children he worked with loved him," she said.
"In what country does being honest and telling the truth get you killed? ... If this is the direction of humanity, then we're doomed."