A former U.S. soldier trained in cryptology and intelligence was charged Monday with attempting to provide material support to a terrorist organization after he flew to Africa in an unsuccessful bid to join al-Shabab, a group with links to al-Qaeda, authorities said.

Craig B. Baxam, 24, of Laurel told FBI agents that he had no contacts with al-Shabab and only a haphazard plan to connect with the group when he boarded a flight out of Baltimore-Washington International Marshall Airport last month, according to a federal criminal complaint. But he said he shared al-Shabab’s religious beliefs — at least as he had read them on an Islamic Web site — and he considered himself obligated to move to land that the group controlled in Somalia.

Baxam appeared in U.S. District Court in Greenbelt on Monday. Kenyan authorities arrested him Dec. 23 near Mombasa, according to authorities. He later told FBI agents that he had been trying to join al-Shabab mainly because he wanted to live somewhere that rigorously adhered to sharia, or Islamic, law, court papers say.

In an interview with FBI agents outlined in the complaint, Baxam admitted a willingness to commit violence, though mostly in defending al-Shabab’s Somali territories from potential invaders. He told the agents that he was specifically seeking al-Shabab — not al-Qaeda — and that he felt offensive jihad was questionable.

Still, Baxam acknowledged that al-Shabab was sometimes responsible for suicide bombings, according to the complaint, and he said he was “looking for dying with a gun in my hand” and would be happy to die defending Islam. He also said al-Shabab’s practice of beating people seen on the street during what is supposed to be prayer time was “awesome.”

Why Baxam became fascinated with al-Shabab and radical Islam remains unclear. A 2005 graduate of Laurel High School who was born in Takoma Park, Baxam joined the U.S. Army in 2007 and completed advanced training in cryptology and intelligence, according to the criminal complaint. He served in Baghdad, then reenlisted for a year-long stint in South Korea.

Baxam left the Army in July — a month before his term was over and about a week after he had “secretly” converted to Islam, according to the complaint. Baxam told agents that he discovered Islam while he was browsing the Internet and had no previous religious affiliation. An online article he read about the Islamic day of judgment “spoke to” him, authorities wrote in the complaint, and he read more.

Baxam’s plan to reach al-Shabab, though, was something less than ironclad. He set out with only a Koran and some other religious texts, a prayer mat, towel and razors, according to the complaint. He carried about $700 in cash and planned to donate it to al-Shabab.

After making his way to Mombasa, then Malindi, Baxam told a taxi driver to take him “as far north as possible” in Kenya, according to the complaint. Dropped off in a city whose name he could not recall, he tried to take a bus to the northern city of Garissa, according to the complaint. He was arrested on that bus by Kenyan police, who suspected that he was trying to travel to Somalia, according to the complaint.

Reached by phone, Baxam’s brother declined to comment and said he did not know whether Baxam had obtained a lawyer. Efforts to reach other family members were unsuccessful.

Baxam told FBI agents that after his military service he worked for a television services company in Maryland but spent much of his time reading and praying, according to the complaint. He soon decided that he needed to move somewhere governed by sharia law, according to the complaint, so he set off for Somalia.

Baxam said he destroyed his computer, withdrew $3,500 that he had saved and purchased a plane ticket to Kenya, according to the complaint. He booked a round-trip flight, according to the complaint, so his activities would not raise authorities’ suspicions.

Staff researcher Jennifer Jenkins contributed to this report.

Matt Zapotosky covers the federal district courthouse in Alexandria, where he tries to break news from a windowless office in which he is not allowed to bring his cell phone.

Comments our editors find particularly useful or relevant are displayed in Top Comments, as are comments by users with these badges: . Replies to those posts appear here, as well as posts by staff writers.

To pause and restart automatic updates, click "Live" or "Paused". If paused, you'll be notified of the number of additional comments that have come in.

Comments our editors find particularly useful or relevant are displayed in Top Comments, as are comments by users with these badges: . Replies to those posts appear here, as well as posts by staff writers.