Major Nidal Malik Hasan, who has been charged with the murders of 13 people at Fort Hood in Texas, has been described as a devout Muslim whose commitment to the army may have been broken by his opposition to the wars in Iraq and Afghanistan - and by plans to deploy him to a war zone.
US officials identified the gunman as Major Nidal Malik Hasan
He is said to have been affected by injuries he saw at the Walter Reed Medical Army Center, where he worked until recently as a psychiatrist treating troops returning from combat.
Maj Hasan, 40, was born and raised in Virginia. His parents moved to the US from a Palestinian town near Jerusalem, according to his cousin.
After high school he joined the US Army, which put him through medical school.
He has been described as devout and discreet. A local imam told the Washington Post that he attended daily prayers at a mosque when he worked at the Walter Reed Army Medical Center in Washington DC.
"We hardly ever got to discussing politics," Faizul Khan said. "Mostly we were discussing religious matters, nothing too controversial, nothing like an extremist."
In other comments Mr Khan said that Maj Hasan had tried, but failed, to find an equally religious woman to marry.
On a form for those looking for spouses through the mosque he listed his birthplace as Arlington, Virginia, but his nationality as Palestinian, Mr Khan said.
Reports suggested in recent years he had become unhappy in the military. He had recently been transferred to Fort Hood.
His cousin said he had faced harassment over his "Middle Eastern ethnicity" and had been trying to leave the army.
His aunt, Noel Hasan, also blamed his desire to be discharged on harassment.
MAJOR NIDAL MALIK HASAN
US-born Muslim raised in Virginia
Joined the army and trained to be a psychiatrist
Treated soldiers returning from combat zones
Described as a devout Muslim who attended prayers regularly
Said to have been unhappy about imminent overseas deployment
"Some people can take it, and some cannot," she told the Washington Post.
"He had listened to all of that, and he wanted out of the military, and they would not let him leave, even after he offered to repay."
Ms Hasan said her nephew had been upset by the injuries he saw at Walter Reed. "He must have snapped," she added.
She said Maj Hasan had spent holidays and free time at her house, and that he "did not make many friends".
He had joined the military over the wishes of his parents, who have since died, his aunt said. Despite his recent attempts to leave, "he would tell us the military was his life".
Several reports said Maj Hasan was about to be deployed overseas against his wishes.
"We've known over the last five years that was probably his worst nightmare," his cousin, Nader Hasan, told Fox News.
The Associated Press cited an unnamed official as saying that Maj Hasan had received a poor performance evaluation from the Walter Reed Army Medical Center before transferring to Fort Hood in July.
Dr Thomas Grieger, who was training director at the centre while Maj Hasan was an intern there, said told AP that he had had "difficulties" that required counselling and extra supervision.
However, Maj Hasan was "mostly very quiet", and never spoke ill of the military or his country, Dr Grieger added.
"He swore an oath of loyalty to the military," he said. "I didn't hear anything contrary to those oaths."
Col Terry Lee, who is retired but said he had worked with Hasan, told Fox that Maj Hasan had often got into arguments with military colleagues who supported the wars in Iraq and Afghanistan.
Maj Hasan had hoped that US President Barack Obama would pull troops out, Col Lee said.
One official was quoted by the New York Times as saying that the FBI had become aware of internet postings by a man calling himself Nidal Hasan.
In one such posting, the act of a suicide bomber who kills himself to protect Muslims was compared to a soldier throwing himself on a grenade to protect other soldiers.
However, officials said they had not confirmed that Maj Hasan was the author of the postings.
Investigators said he will face 13 initial murder charges with the possibility of additional charges later.