An FBI undercover agent encouraged a terrorist to “tear up Texas” before the 2015 Garland, Texas shooting, and was at the crime scene and failed to stop or engage the perpetrators.

This was revealed in an investigation by CBS’s “60 Minutes” that aired Sunday. The Garland shooting left two terrorists, Elliot Simpson and Nadir Soofi, dead. They attempted to attack an event featuring cartoons of the Muslim prophet Mohammed, but were stopped by local police.

The attorney for Abdul Malik Abdul Kareem, who was sentenced for helping the two terrorists carry out the attack, revealed information on “60 Minutes” from the government which showed the FBI’s close proximity to the attack.

“After the trial we found out that they had had an undercover agent who had been texting with Simpson, less than three weeks before the attack, [writing] to him ‘Tear up Texas,'” attorney Dan Maynard said.

Simpson responded, “bro, you don’t have to say that…” The terrorist added, “you know what happened in Paris… so that goes without saying. No need to be direct.”

The FBI argued that the “Tear up Texas” message was not incitement.

An affidavit filed in another case said that the agent also “traveled to Garland, Texas, and was present… at the event.”

Maynard was given documents that showed the FBI agent was in a car directly behind Simpson and Soofi when they started shooting, and that he had taken a cell-phone photo of the security guard and police officer who engaged in a firefight with the terrorists.

“The idea that he’s right there 30 seconds before the attack happens is just incredible to me,” Maynard said.

“There was no advance knowledge of a plot to attack the cartoon drawing contest in Garland, Texas,” the FBI said in a statement to CBS after declining an interview request.

The “60 Minutes” episode also revealed that the undercover agent left the scene and was arrested by police at gunpoint. The Mohammed drawing event was being hosted by the American Freedom Defense Initiative (AFDI). Pamela Geller, who runs AFDI, penned a blog post Monday which said, “The FBI wanted us dead.”

The FBI has a history of using stings to catch terrorists, and has been accused of entrapment.