(CNN) Gavin Long, the man who killed three law enforcement officers in Baton Rouge, Louisiana, before a SWAT team officer shot him dead -- told friends and relatives that he suffered from post-traumatic stress disorder, a source involved in the investigation told CNN's Chris Cuomo.

Long joined the Marine Corps in 2005, worked as a data network specialist and served in Iraq before being discharged as a sergeant in 2010, according to the U.S. military.

Long had filled a prescription for Ativan, an anti-anxiety drug, as recently as June, said the source, who spoke on condition of anonymity. He also had prescriptions for Valium and the sleep aid Lunesta, the source said.

It wasn't immediately clear whether anyone had diagnosed him with PTSD.

CNN has filed a Freedom of Information Act request with the military to obtain records about Long's service. Under Defense Department rules, health records that might include any information on Long's mental health are considered protected, even though he is dead. The records are part of the criminal investigation.

Valium, like Ativan, is a benzodiazepine -- a class of medication with sedative properties that are prescribed for anxiety, insomnia and other conditions.

Symptoms of PTSD can include, but are not limited to, feelings of anxiety, insomnia and nightmares.

Sunday's ambush of police by Long, a 29-year-old black man, came nearly two weeks after a police officer shot and killed Alton Sterling, a black Baton Rouge resident, outside a convenience store in the city on July 5.

Gunman advocated 'fighting back'

of Kansas City, Missouri, stalked Baton Rouge officers on Sunday before shooting six officers in an ambush, Police say Long,of Kansas City, Missouri, stalked Baton Rouge officers on Sunday before shooting six officers in an ambush, killing three -- Baton Rouge police Officers Montrell Jackson and Matthew Gerald and East Baton Rouge sheriff's Deputy Brad Garafola -- and wounding three others.

A SWAT team rifleman subsequently shot and killed Long with a shot from 100 yards, police said.

"There is no doubt whatsoever that these officers were targeted and assassinated," Louisiana State Police Col. Michael D. Edmonson said Monday.

One of the three injured officers, Deputy Nicholas Tullier, was critically wounded and "fighting for his life," Sheriff Sid Gautreaux said Sunday.

Edmonson told CNN on Wednesday that Long was seen "riding around" the area in the days before the attack. The shooter stayed at several locations, according to Edmonson. State police have interviewed people who interacted with Long.

Long apparently visited Dallas after the shootings there, posting a YouTube video July 10 in which he said he was in the Texas city and spoke of the recent protests and officer-involved shootings.

In the video, Long mentions the July Fourth holiday as a celebration of an uprising against oppressive forces. Without mentioning Micah Xavier Johnson -- the Dallas shooter -- by name, he questions why some violent actions are perceived as criminal while others are celebrated.

He also said that victims of bullying need to resort to brute force.

"One hundred percent have been successful through fighting back. Through bloodshed," he said in the video. "Zero have been successful just over simply protesting. It has never worked, and it never will."

In another video, Long is in Baton Rouge driving around with a man he apparently recently met and offering people copies of a self-published self-help book. Long talks almost the entire time, lecturing one young man about life, telling him to develop multiple job skills and not strictly depend on income from his rapping. Long also tells him not to trust people of other races.

He says if he had been there when Sterling was killed he would have done something.

Long left a trail of writings, videos and social media posts describing his thoughts, ideas and worldview under the pseudonym Cosmo Setepenra. He legally changed his name to Setepenra last year.

Long rented a car in Kansas City after the Dallas shootings and eventually drove it to Baton Rouge, two law enforcement sources told CNN.

Carl Woodley, Long's stepfather, said he was in "total shock" about the Baton Rouge shootings. He said he was sorry about what happened to the officers and about losing his stepson.

Woodley said Long was about 7 when they met and he remembered him as a good, quiet and intelligent boy.

"I never had ... problems with him," he said. "He wasn't my biological son, but he was a son to me. ... We were real close."

Long never talked to him about anger toward the police or the way they treated blacks, said Woodley, who added he never saw his stepson with a weapon.

Baton Rouge, Dallas shooters were military veterans

During his five years in the Marine Corps, Long served in Iraq from June 2008 to January 2009, and also spent some time in California and Japan.

He received a handful of awards, including the Marine Corps Good Conduct Medal.

A research report on the department's website says that "although PTSD is associated with a risk of violence, most people with PTSD have never engaged in violence."

Like Long, Dallas shooter Johnson had military ties, having been an Army reservist. Dallas police Chief David Brown said Johnson, a black man, had expressed that he was upset about recent police shootings, wanted to kill white people and white police officers, and "expressed anger for Black Lives Matter."

Johnson was killed by a bomb delivered by a police robot on the night of the Dallas attack after failed negotiations, police said.

In an interview this month with The Blaze , Johnson's parents and stepmother said he changed after military service, which included deployment to Afghanistan from late 2013 to mid-2014. Before joining the military, he'd wanted to become a police officer, said his mother, Delphine Johnson.

"The military was not what Micah thought it would be," she said. "He was very disappointed, very disappointed. But it may be that the ideal that he thought of our government, what he thought the military represented, it just didn't live up to his expectations."