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: Arlington Home Catches Fire During Sunday Storms

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: Head-On Crash Near Glen Rose Leaves 3 Dead, Officials Say

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: Unvaccinated COVID-19 Patients Filling Up Hospitals, Austin Officials Say ICU Capacity Reaching 'Critical Point'

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