The US soldier suspected of shooting dead three people before killing himself at the Fort Hood Army base in Texas was identified as Ivan Lopez, a man battling mental illness when he went on a rampage.
Lieutenant General Mark Milley, the base commander, announced the suspect's identity on Thursday.
The motive of the shooter remains unclear, but officials have ruled out terrorism.
"There may have been a verbal altercation with another soldier or soldiers. There is a strong possibility that that in fact immediately preceded the shooting," said Milley, adding there was no indication that he targeted specific people.
Lopez, 34, originally from Puerto Rico, had been treated for depression and anxiety. He was being evaluated to see if he suffered from post-traumatic stress disorder, or PTSD, military officials said.
He is suspected of smuggling onto the base a recently purchased Smith & Wesson .45-calibre pistol that was used in the shootings, Reuters news agency reported.
Milley said Lopez purchased the firearm at Guns Galore, the same store in Killeen where former Army psychiatrist Major Nidal Hasan bought the weapon he used to kill 13 people and wound 32 others at Fort Hood in 2009.
Wednesday's incident was the second shooting spree in five years at one of the largest military bases in the US, and the third shooting at a US military base in six months.
Mental health issues
US Army Secretary John McHugh said Lopez, who joined the service in 2008, had served two tours of duty abroad, including four months in Iraq in 2011. He had no direct involvement in combat and had not been wounded.
"He was undergoing a variety of treatment and diagnoses for mental health conditions, ranging from depression to anxiety to some sleep disturbance. He was prescribed a number of drugs to address those, including Ambien," McHugh told a US Senate committee hearing.
Lopez served in the Puerto Rico National Guard for several years in an infantry unit and as a band member, both military combat training assignments. He also did a stint as part of an observation mission in the Sinai, Egypt, Puerto Rico National Guard Major Jamie Davis said.
Reuters reported that Army chaplains visited Lopez' family on Thursday. Lopez was reportedly calm when he had gone home for lunch on the day of the shooting.
When confronted by a military police officer in a parking lot on Wednesday, he killed himself with his semi-automatic weapon.
Retired Army Sergeant Alonzo Lunsford, who was shot multiple times in the 2009 incident at Fort Hood, said the military has not done enough to treat the mental scars of those who have served in combat regions.
"The military needs to go ahead and stop talking about the problem and talking about what we're going to do. Just do it," Lunsford said.
There are about 45,000 soldiers and airmen assigned to the 870 square kilometre base along with nearly 10,000 civilian employees, according to Fort Hood.