LOS ANGELES – One was a troubled 23-year-old, with an assault rifle and an apparent grudge against the government, who witnesses said seemed to be hunting for airport security officials. The other was a 39-year-old father of two who for three years had been a screener of the torrent of passengers who move through the security lines at Los Angeles International Airport.

In a few chaotic minutes Friday morning, their paths crossed by happenstance and the security agent, Gerardo Hernandez, lay dead. Paul Ciancia, identified by the police as the gunman, was critically wounded, shot in the head by officers in pursuit to stop a rampage. All around, the everyday drudgery of passing through security gates turned into terror, passengers running for their lives as armed police officers ordered them to hit the floor.

'Decision to try to kill'

As law enforcement officials sought a motive Saturday, it became clear that Ciancia was a drifter who had come to Los Angeles without a job and with a little money, according to friends, and settled with roommates for a time in an apartment complex in Atwater Village, a working-class neighborhood north of downtown Los Angeles that is an enclave for young professionals and artists. One former roommate who did not want to be identified said Saturday that Ciancia had slept on his couch from late 2012 until February of this year and did not have a job at the time. Then he left.

In court documents filed Saturday, prosecutors brought two federal charges against Ciancia — murder of a federal officer and committing violence at an international airport, both of which carry a maximum sentence of life without parole or the death penalty. The documents said a handwritten letter found at the scene showed that Ciancia "made the conscious decision to try to kill" TSA employees. In a part of the letter, addressing TSA employees, he wrote that he wanted to "instill fear in your traitorous minds." There were a total of five gunshot victims. Two of the wounded were TSA agents, and two others were hurt while trying to escape.

Prosecutors said Ciancia shot Hernandez several times at point-blank range, went up an escalator, and then, seeing the wounded officer move, returned to fire again. He shot at least two other uniformed TSA employees and one passenger, the documents said. The gun was described as a Smith & Wesson 223 M & P15 rifle.

Ciancia had assembled a small arsenal. Law enforcement officials said two legal guns registered to him were purchased this year at the Target Range in Van Nuys in suburban Los Angeles. The rifle recovered at the airport was also purchased by Ciancia in the Los Angeles area, said a senior federal official.

'Some depression issues'

It was a world away from Pennsville, the small town in New Jersey where he grew up, his father owning an auto body shop nearby. Ciancia attended a Catholic boys school in nearby Wilmington, Del. Several family friends, neighbors and classmates described him as a reserved, quiet boy who, along with his younger brother, Taylor, seemed to be scarred by his mother's long battle with multiple sclerosis and her death in 2009.

"It was very hard for them," said Amanda Lawson, 21, a waitress in the Broadway Diner in Pennsville, who graduated from Pennsville Memorial High School in 2010 with Ciancia's brother. She described both brothers as "awkward." "They had some depression issues, and they both got obsessive," she said Saturday.

Ciancia graduated from the University Technical Institute in Orlando, Fla., in December 2011, a school spokesman said. He received a diploma that allowed him to become an entry-level motorcycle technician at a dealership or shop, institute spokeswoman Tina Miller said.

But he had apparently turned against the government, and it seemed clear that Ciancia knew he was putting himself in a suicidal situation by marching with an assault weapon and 100 rounds of ammunition into the third-busiest airport in the country, officials said. He seemed to have a specific grudge against the TSA; his note singled out the agency as a symbol of what was wrong with the government, mentioning by name the former head of homeland security, Janet Napolitano, a federal official said.