A student detained at Philadelphia International airport over his Arabic flashcards can't sue the individual federal agents who held him in custody, an appeals court has ruled.

The 3rd Circuit Court of Appeals in Philadelphia reversed a lower court ruling Tuesday, holding that the three Transportation Security Administration agents and two Federal Bureau of Investigation agents have qualified immunity in the suit filed by Nicholas George.

George filed suit after he was detained at the Philadelphia airport in August 2009, while he was flying to California to begin his senior year at Pomona College, when agents found Arabic-English flashcards in his backpack. The cards included both common words such as "nice", "sad" and "friendly," and words like "bomb," "terrorist" and "explosion."

Court documents say George, who was double majoring in physics and Middle Eastern studies, was subjected to aggressive questioning, handcuffed and locked in a cell for more than four hours.

Chief Judge Theodore McKee, writing for a three-judge Circuit Court panel, said the law enforcement officials' actions were reasonable, and George can't pursue claims against the individual agents. George's cases against Philadelphia police officers, including the officer who put him in handcuffs, and the federal government aren't affected by the ruling.

McKee said George clearly had the right to have the materials, but "it is simply not reasonable to require TSA officials to turn a blind eye to someone trying to board an airplane carrying Arabic-English flashcards with words such as 'bomb,' 'to kill,' etc."

He added: "Rather, basic common sense would allow those officials to take reasonable and minimally intrusive steps to inquire into the potential passenger's motivations."

The court's holding cautioned that George's detention was at the "outer boundary" of what's permissible under the Fourth Amendment, and "much of the concern that justified his detention dissipated" after agents determined he wasn't carrying weapons or explosives. But the additional inquiry remained warranted, McKee wrote.

"Suspicion remained, that suspicion was objectively reasonable given the realities and perils of air passenger safety," the ruling says.