A man who had fired a gun inside a ticketing area at Houston’s largest airport died of a gunshot wound after being confronted by a law enforcement official during an incident that sent people in the terminal scrambling and screaming, police said Thursday.

It’s unclear if the man fatally shot himself or was killed by a Homeland Security agent who had confronted him, Houston police spokesman Kese Smith said. The man’s name was not released by police, but they said he was about 30 years old.

Police say the man walked into the ticketing area in Terminal B at Bush Intercontinental Airport around 1:35 p.m. and fired at least one shot into the air. The agent, who was in his office, came out and confronted the man, telling him to drop his weapon, but the man refused, police said.

“The suspect then turned toward the special agent. The special agent, fearing for his safety and all the passengers in the terminal, discharged his weapon at the same time it appears the suspect may have shot himself,” Smith said.

The man died at the scene. An autopsy will be conducted today.

Police would not say what kind of weapon the man had.

The terminal was closed immediately after the shooting. But later Thursday, parts were reopened to passengers. The rest of the airport remained open after the shooting.

Darian Ward, a spokeswoman for the Houston Airport System, said passengers who were scheduled to leave from Terminal B were being rerouted to other terminals.

Dale Howard, of Tomball, was at the baggage handling area waiting for his sister’s flight to arrive when he heard two shots fired from the floor above. A few seconds later, he said he heard three more shots.

“People were screaming. I knew exactly what it was — gunfire,” Howard said.

Police from an adjacent station rushed in, and Howard said he directed them to the floor above.

Greg Newburn, who was in the terminal waiting for a flight to Oklahoma City, said he was sitting in a cafe area when he heard two gunshots and after a pause, several more.

“It seemed like quite a few shots. Everyone was scrambling, running left and running right, turning tables up and hiding behind tables. Nobody knew what was happening. I couldn’t tell where the shots were coming from,” he said.

Newburn, from Gainesville, Fla., said it took him a few seconds to realize the shots had come from the ticketing area, near the security checkpoint.