HONOLULU — The Army knew Sgt. 1st Class Ikaika Kang had shown support for Islamic State years ago. It even took away his security clearance for a while.

But he stayed in the service, deploying to Afghanistan in 2013.

Then, last weekend, the FBI arrested the 34-year-old on terrorism charges following a yearlong investigation, shortly after Kang declared his loyalty to the terrorist group and exclaimed that he wanted to "kill a bunch of people," according to authorities.

The case highlights the challenges investigators face with protecting the public from a potentially dangerous actor on one hand and gathering sufficient evidence to enable prosecution on the other.

Kang is on record making pro-Islamic State comments and threatening to hurt or kill other service members back in 2011, according to an FBI affidavit filed Monday in federal court.

The Army revoked his security clearance in 2012, but gave it back to him the following year. Last year, the Army called the FBI when it "appeared that Kang was becoming radicalized," the affidavit said.

Retired Army judge and prosecutor Col. Gregory A. Gross said he was perplexed that the Army allowed Kang to remain a soldier even after his favorable comments toward the Islamic State group.

But Gross said the Army may have decided Kang was just mouthing off and was not a threat.

Gross served as the initial judge in the court martial of Maj. Nidal Malik Hasan, an Army psychiatrist who killed 13 people and wounded more than 30 in a 2009 shooting at Fort Hood, Texas. He said Tuesday he was concerned by the similarities between Kang and Hasan's case.

"He was making all these statements, and giving these presentations," said Gross, who is currently a civilian defense attorney for military service members.

Kang's court-appointed lawyer, Birney Bervar, said his client may suffer from service-related mental health issues of which the government was aware but neglected to treat. He declined to elaborate.

Noel Tipon, an attorney in military and civilian courts, said there's nothing in the Army manual on removing soldiers from the service that would address allegations like speaking favorably about a group like Islamic State.

He suspects the FBI wanted to Kang to stay in the Army while they investigated whether he had collaborators.

"They probably said 'let's monitor it and see if we can get a real terrorist cell,' " said Tipon, who served in the Marine Corps.

The FBI said its investigation showed Kang was acting on his own.

Spokesman Arnold Laanui said the probe took nearly a year given the evidence that needed to be collected and the constitutional rights that needed to be protected.

"These tend to be very meticulous and time-consuming matters," Laanui said. Public safety, he said, was at the forefront of the case, he said.

The FBI outlined its evidence against Kang in a 26-page affidavit filed Monday. It includes allegations Kang filmed a combat training video for Islamic State and bought a drone he believed would be sent to the Middle East to help the group's fighters.

Agents said none of the military documents — classified and unclassified — Kang gave to people he believed were affiliated with Islamic State ever got to the group.

Kang's father told Honolulu television station KHON and the Star-Advertiser newspaper his son may have had post-traumatic stress disorder. Kang told the newspaper he became concerned after his son's return from Afghanistan. He said his son was withdrawn.

Kang enlisted in the Army in December 2001, just months after the Sept. 11 attacks. He served in South Korea from 2002 to 2003. He deployed to Iraq from March 2010 to February 2011 and Afghanistan from July 2013 to April 2014.

Kang was scheduled to appear in court Thursday for a detention hearing.