The interior ministry said the rampage was not linked to "terrorism", but a defence ministry spokesman did not rule this out before an investigation reports on the incident.
Defence ministry spokesman Belhassen Oueslati said that corporal Mehdi Jmai, who was born in 1979 and had been serving in the army since 1999, "had family and psychological problems".
"He had been high strung for weeks and had become undisciplined," said the spokesman.
Because of this, he had been "forbidden from carrying arms" and given "non-sensitive duties", he said.
The incident "caused the deaths of seven soldiers and also of the shooter. Ten soldiers were wounded, and one is in a serious condition," he added.
Today's shooting was at the Bouchoucha barracks in Tunis, not far from parliament and the Bardo National Museum where jihadist gunmen killed 21 foreign tourists and a policeman in March.
It triggered a security alert across the Bardo district, AFP correspondents reported.
One heard two volleys of gunfire from inside the barracks at around 8:45 am (local time), before an ambulance emerged, its siren blaring.
Police with sniffer dogs also checked parked vehicles for fear of car bombs in the district, which also houses two police barracks.
"The incident which took place at the Bouchoucha barracks is not connected with a terrorist operation," interior ministry spokesman Mohamed Ali Aroui told AFP initially.
The defence ministry's Oueslati said the shooter had been killed.
"The armed forces took control of the situation after firing on the soldier," Oueslati told AFP.
"Investigations will show whether this was a terrorist act or not," Oueslati told reporters, adding that all theories would be examined.
You’ve reached your limit of {{free_limit}} free articles this month.
Subscribe now for unlimited access.
Already subscribed? Log in
Subscribe to read the full story →
Smart Quarterly
₹900
3 Months
₹300/Month
Smart Essential
₹2,700
1 Year
₹225/Month
Super Saver
₹3,900
2 Years
₹162/Month
Renews automatically, cancel anytime
Here’s what’s included in our digital subscription plans
Exclusive premium stories online
Over 30 premium stories daily, handpicked by our editors


Complimentary Access to The New York Times
News, Games, Cooking, Audio, Wirecutter & The Athletic
Business Standard Epaper
Digital replica of our daily newspaper — with options to read, save, and share


Curated Newsletters
Insights on markets, finance, politics, tech, and more delivered to your inbox
Market Analysis & Investment Insights
In-depth market analysis & insights with access to The Smart Investor


Archives
Repository of articles and publications dating back to 1997
Ad-free Reading
Uninterrupted reading experience with no advertisements


Seamless Access Across All Devices
Access Business Standard across devices — mobile, tablet, or PC, via web or app
