WASHINGTON – John Patrick Bedell, whose doomed, cross-country odyssey ended in a brief gun battle outside the Pentagon on Thursday night, was a well-educated but troubled student of science, economy and society who believed that the United States was controlled by a sinister organization leading it toward a new dark age, according to friends and Internet postings attributed to him.

Bedell, 36, who was shot and killed by Pentagon security guards, had recently been living with his parents in Hollister, Calif., a friend of the family said, but had dropped out of contact after saying he was taking off on a car trip. His parents recently filed a missing persons report with authorities. His parents warned authorities their son was upset and might have a gun, a source told the Associated Press.

In recent weeks, he seems to have wandered back and forth across the country. He had chronic mental health problems, investigators said, and had been treated as an inpatient at mental health institutions four times.

“We are devastated,” his family said in a statement Friday. “To the outside world, this tragedy is the first and only thing they will know of Patrick. To us, he was a beloved son, brother, grandson, nephew and cousin. We may never know why he made this terrible decision. One thing is clear though — his actions were caused by an illness and not a defective character.”

It’s not clear exactly when Bedell began his journey to Arlington, Va. He drove a green 1998 Toyota Avalon, which police found in a nearby parking garage. A cache of ammunition was found in the car.

Bedell left behind numerous written, video and audio manifestos on the Internet. In an audio address, he suggested that the United States was infiltrated by a cabal of gangsters called the “coup regime” after the 1963 assassination of President John F. Kennedy. He said he believed the cabal was probably behind things such as the Sept. 11, 2001, terrorist attacks and the Iraq war, and continued to manipulate the country “up to the present day.”

In recent years, in conversations with friends and in Internet postings, Bedell spoke often and at length about social issues and what he saw as attacks on personal liberty. He was especially irked by criminal penalties for marijuana use, said Reb Monaco, who has known Bedell since Bedell was a child. Bedell had not expressed hostility toward the military, Monaco said

Monaco said he and his wife were with Bedell’s parents as they learned their son’s cross-country trip had ended at the Pentagon. Armed with two handguns, he shot and wounded two officers from the Pentagon Force Protection Agency. Bedell was then shot in the head and upper left arm and died later at George Washington University Hospital in Washington.

Bedell, who was known to friends and family as Patrick, “had gone off the deep end right before he left, his parents told us,” Monaco said Friday after spending the night and morning at the Bedell family home.

Bedell was intelligent and highly animated over “personal politics of what he thought he should and should not be able to do in his own life, that is what he would talk about,” Monaco said. During “the last few years of his life (he) had troubles with drugs, especially marijuana.”

He had studied electrical engineering and “was very smart about and interested in computing,” Monaco said. “This is really a tragedy for the family, who are devastated.”

Bedell had been arrested in drug cases and talked “often about drug use and why it was helpful to him,” said Monaco, who said Bedell’s drug arrests stretched back several years and were a source of “great concern to his parents.”

“He was not a person who should have been issued a medical clearance to use marijuana, but he was,” Monaco said.

A Web page that included a speech by Bedell on YouTube also cited a 2006 Orange County, Calif., drug case for marijuana cultivation with a name and date of birth that matched Bedell’s, as well as a copy of a July 2006 prescription for medical use of marijuana issued to a “John Patrick Bedell” for “chronic insomnia.”

Meanwhile, the two security officers were reported to be recovering from minor injuries at home.

Officers Jeffrey Amos and Marvin Carraway were superficially wounded, one in the shoulder and one in the thigh. Both were treated at George Washington University Hospital and released.

They and a third officer returned fire at Bedell, critically wounding him in the head, said Richard Keevill, chief of the Pentagon Force Protection Agency.