The arrest of a Kansas man accused of trying to bring what he thought was a car bomb into a Wichita airport marked the culmination of a months-long undercover sting in what has become a successful and widely used domestic counterterrorism tactic.

Court documents detail Terry Lee Loewen’s alleged conversations with undercover FBI agents over six months. The discussions began with vague sentiments about his desire to commit “violent jihad” against the U.S. before turning into a detailed, concrete plot in which the agents recruited him to use his airport access to plant a bomb in a martyrdom operation.

Loewen, a 58-year-old avionics technician who worked at the airport for Hawker Beechcraft, was arrested Friday on charges including providing support to al-Qaida and attempting to use a weapon of mass destruction. He remains jailed, and prosecutors expect to take their case to a grand jury Wednesday.

The case resembles a string of investigations conducted by the FBI since the Sept. 11 terrorist attacks that have prompted controversy over whether law enforcement’s tactics involve entrapment and violate civil liberties.

One such case involved an undercover agent pretending to be a terrorist who provided a teenager with a phony car bomb, then watched him plant it in downtown Chicago. In Boston, a man was sentenced to 17 years in prison for plotting with undercover agents to fly remote-controlled planes packed with explosives into the Pentagon and U.S. Capitol.

The FBI insists the stings are a vital, legal tool for averting potentially deadly terrorist attacks — and juries have returned tough sentences.

Dan Monnat, a prominent Kansas defense attorney who isn’t representing Loewen, said the 21-page criminal complaint against Loewen doesn’t contain enough information to find his guilt or evidence of FBI entrapment. But he questioned the FBI’s tactics.

“If the fragile mental state of an otherwise upstanding individual is exploited to commit a crime that the individual otherwise would not have taken steps to commit, how does that make us safe and why spend taxpayer money on prosecution?” Monnat said Saturday.

But entrapment defenses have failed in various cases. In a 2009 case in New York, a federal judge said she was not proud of the government’s role in nurturing an alleged conspiracy in which four men were convicted in a plot to bomb synagogues and shoot down military planes with missiles. The men were each sentenced to 25 years in prison.

In an unsuccessful appeal, the defense argued the men were harmless dupes led astray by an FBI informant who infiltrated a mosque. With the encouragement of the informant, one of the men hatched the scheme to blow up the synagogues in the Bronx and to shoot down military cargo planes with missiles.

The appeals court found the government’s tactics didn’t rise to the level of “outrageous misconduct.”

Court documents don’t specify what initially led investigators to Loewen, though he allegedly told an undercover agent during one online exchange: “hey I read Inspire magazine; I believe in staying informed.” Inspire, an English-language online magazine, is produced by al-Qaida affiliates. It includes such things as bomb-making instructions and endorsements of lone-wolf terror attacks.

He also allegedly told the undercover agent he’d downloaded tens of thousands of pages about jihad, martyrdom operations and Sharia law, and printed out an al-Qaida manual — online activity that often draws law enforcement’s attention.

U.S. Attorney Barry Grissom declined to discuss the case Saturday. But in May, he told students during an event at Wichita State University that authorities monitor extremists groups’ websites, including Inspire magazine.

“Do not go to this website,” Grissom said. “You will be on our list.”

In Loewen’s case, court documents paint an undercover operation in which Loewen and two FBI agents posing as conspirators ultimately hatched a plot to place a vehicle full of explosives at the Wichita airport. He allegedly timed it to cause “maximum carnage” and death, according to an FBI affidavit.

Loewen was arrested early Friday as he twice tried to use his badge to gain entry to the tarmac.

In a letter dated Wednesday that prosecutors say Loewen left for a family member, Loewen said he expected to be martyred for Allah by the time the letter was read. He wrote that his only explanation was that he believed in jihad for the sake of Allah and his Muslim brothers and sisters, though he said most Muslims in the U.S. would condemn him.