Veteran Dallas Morning News photojournalist Tom Fox said he thought he "was gone" when he hid in an alcove from a heavily armed masked man at the downtown federal courts building Monday morning.

“I just kept thinking, 'He's going to look at me around that corner and he's going to shoot,'" Fox said.

Seconds earlier, Fox had heard what sounded like gunshots. He saw a figure emerge down the block, but he couldn't make out details.

Tom Fox, Dallas Morning News photojournalist (Staff Photo)

"So I pulled up my long lens and saw someone who I realized was the shooter. And I think, 'Oh my God.' I squeezed off a few frames as he picked something up — a clip, I think — and then I turned and ran."

Fox was at the Earle Cabell Federal Building for a routine assignment: get a photo of a defendant in a charter school fraud case.

Once he got the shots, he planned to head to the Winspear Opera House to cover the mayoral and City Council inauguration.

For about an hour, Fox had no luck. He passed the time watching people come and go while a homeless man danced at the corner of Griffin and Jackson streets.

He figured directing a wrong-way driver on Jackson Street to do a U-turn would be the most exciting moment of the morning. Then, minutes later, “I heard a bang-bang-bang car-backfiring noise and I thought, ‘Could it be? Is this a shooting’?"

Fox immediately crouched with a wide-angle lens on the sidewalk near the courthouse’s Jackson entrance and began photographing as a man in a suit and a security guard ran past him. Bullets ricocheted off the wall above Fox.

Through his camera, he saw the gunman and took the photos. Then he tried to flee.

An armed shooter outside the Earle Cabell Federal Building looks in the direction of Dallas Morning News photojournalist Tom Fox, who was at the courthouse Monday morning on another assignment. (Tom Fox / Staff photographer)

Fearing he would be shot in the back, Fox jumped behind a column in the building’s façade. He said he “made myself as small as possible.”

“I just stood there and prayed that he wouldn’t walk past me,” Fox said. “Because if he walks past me and sees me, he’s going to shoot me. He’s already got the gun out.

“I was just praying, ‘please don’t pass me, please don’t pass me.’”

Instead, the gunman began to fire into one of the building’s glass doorways in the direction of the metal detectors and security guards inside.

The gunman then fired toward what Fox assumed were law enforcement mobilizing at the end of the building. Two of those bullets struck the wall just feet from Fox.

“I saw the puff of smoke, but I didn’t know at the time whether that was him or the police firing," he said.

“I’ll never forget the sound of those repeated firing and all that glass shattering. It seemed like forever before I heard return gunfire.”

As officers asked where the shooter went, the photographer repeatedly responded that the gunman had not passed him. As officers began to run across Jackson Street, Fox finally felt he could move — and relax his worry that the gunman would find him.

“If they were running out in the open, I figured it was safe,” he said.

Members of the Department of Homeland Security and the U.S. Marshals Service tend to the downed shooter after shots were fired Monday morning at the Earle Cabell Federal Building in Dallas. (Tom Fox / Staff Photographer)

Fox followed three officers as they crossed Jackson into the parking lot. Then, crouching behind two cars, Fox realized they had someone on the ground. He took more pictures and video as the officers examined the man and pulled off his mask.

"And he was just so young. All I could think was 'why?’ There's just too many questions I haven't processed yet,” Fox said. “But this young man, what was it all for? Was it really worth it — for this?"

As law enforcement began to set up a perimeter around the crime scene, Fox and other witnesses were shepherded to the FBI command post a block from El Centro College. Fox said he answered a dozen or so questions about what he saw and then was escorted back to his vehicle. Along the way, he managed to get a photo of a bomb squad robot alongside the gunman's car.

“Your journalistic instincts just kick in,” he said. “You use the camera almost as a shield. I also felt a journalistic duty to do all that.”

Fox has worked as a photojournalist with The News for 29 years. He has covered his share of harrowing weather-related events such as hurricanes and tornadoes. He said among the days that stuck out was when he encountered "pit bulls in the middle of nowhere" in Louisiana after Hurricane Katrina. He fended the dogs off with his telephoto lens until he got back to his truck — "they hadn't eaten in a week and they weren't happy," he said.

"That's the kind of stuff that comes with the job,” Fox said. “Nothing like this — it just doesn't seem real."

Until Monday, Fox said, he had never feared for his life while on assignment. But he had heard stories from colleagues about covering the July 7, 2016, downtown Dallas ambush on police, about bullets whizzing by amid chaos.

“The July 7 shooting made me more prepared as a journalist, watching my colleagues go through that,” Fox said.

After he returned to the newsroom Monday, he edited his photos and videos and worked with editors and news art designers. He told a colleague that he figured “if you stay in this business long enough, you're bound to get shot at."

But he said he had “to put this on the shelf and process it later.”

“For now, it’s about telling this story right,” Fox said.