Follow CBSDFW.COM: Facebook | Twitter

Court records show an undercover FBI agent who was investigating terrorism was driving past two Arizona men in 2015 just before they opened fire outside a Prophet Muhammad cartoon contest in Garland.

READ MORE: I-Team: Bank Of America And Zelle Customers Targeted In New High-Tech Scam

The records also show the agent had exchanged social media messages with one of the gunmen days before the 2015 attack.

An attorney for a Phoenix man convicted of helping plot the shooting says in court records that the agent’s presence raises questions about whether authorities could have done more to thwart the attack.

READ MORE: Technology Helping Melissa ISD Retain School Bus Drivers During Nationwide Shortage

The FBI declined to comment.

The records also say the agent drove away and was stopped by police officers. He wasn’t hit by the gunfire, but it’s unclear what happened with him after the shooting ended.

His presence at the contest wasn’t publicly revealed until 15 months after the attack.

MORE NEWS: Parents Share Safety Concerns At Mansfield ISD Town Hall On Campus Security Following School Shooting

(© Copyright 2017 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)