The 22-year-old masked gunman who fired a rifle at a federal courthouse in Dallas on Monday morning, injuring no one, died after being shot by police -- who now must figure out why Brian Isaack Clyde opened fire.

Clyde, identified later Monday morning by authorities, had been taken to a hospital after he was captured near the Earle Cabell Federal Building in downtown Dallas -- just one block away from where five police officers were murdered in a 2016 ambush attack.

"He had an assault rifle. His face was kinda masked up," one witness, Alan Wyatt, told KDFW. "And when I saw that I was just in shock. I ran."

Videos taken by witnesses show Clyde firing at the courthouse and running through its parking lot before being hit by gunfire from police officers.

Officials told the Dallas Morning News that Clyde opened fire shortly before 9 a.m. local time. A witness told the newspaper the shooter fired off rounds for about 45 seconds – and a photographer on-scene reported seeing the glass in one of the building’s revolving doors shattered in the aftermath.

CLICK HERE TO GET THE FOX NEWS APP

Police later carried out a controlled detonation of a "suspicious device" inside of a nearby vehicle believed to be owned by Clyde. The ATF and Dallas County Sheriff's Department were assisting in the investigation and the streets around the courthouse remained shut down.

The scene is about a dozen blocks from the Winspear Opera House, where, on Monday morning, the new Dallas mayor and city council were being sworn in, a WFAA reporter tweeted.