an undercover fbi operation exposes al qaeda terrorists posing as refugees in the middle of the american heartland. They quickly learn that lax background checks were to blachblame. Turns out that's... See More
an undercover fbi operation exposes al qaeda terrorists posing as refugees in the middle of the american heartland. They quickly learn that lax background checks were to blachblame. Turns out that's just the beginning. There may be dozens more in the country now as well. Chief investigator reporter, brian ross got access to undercover investigation for "nightline" investigates. Reporter: This fbi surveillance video was made not in afghanistan, or iraq, but in kentucky. It shows an admitted al qaeda terrorist who had already killed american soldiers in iraq, trying to get weapons to kill more of them. And authorities tell abc news, he may be just one of dozens of men with american blood on their hand who were mistakenly allowed to settle in the u.S. As refugees. I wouldn't be surprised if there are many more than that. These are trained terrorists in the art of bomb making that are inside the united states and quite frankly, from the homeland security perspective, that greatly concerns me. Reporter: The startling discovery of al qaeda in kentucky took place in bowling green, kentucky, a city of 60,000 people. Sechl lea seemingly far removed from concerns about terrorists next door until these two men quietly moved in. Of all places in the world or united states, why bowling green? The two men came from iraq four years ago among tens of thousand of refugees who the state department approved off to come here seen as no threat to the u.S. But the two were, in fact, as the fbi part of the al qaeda connected insurgent group who had already killed american soldiers with roadside bombs. The group produced this video of their ataxes around tacks. One bomb killed four members of the pennsylvania national guard on patrol in a humvee in 2004. As this sergeant painfully recalls. A somber moment for the platoon. A great deal of love and respect for the guys. It hit hard. Dan south the only one in the humvee to survive the attack. The guys who did it what happened. Other than thamet. Reporter: Not just get away with. An abc news investigation found that the two terrorists, were able to get through a flawed u.S. Cyst temperature of background checks and end up in bowling green. One living in this public housing apartment on public assista assistance, put under 24 hour surveillance by fbi agent dick glen and others. We realize we had a man here with american soldiers blood on his hands. It took it to a whole new level for us. The other iraqi lived in this residence near the high school. As the fbi would learn in the course of its undercover operation. The two iraqis were intent on killing even more americans. These two individuals specifically are innately evil. To act as a terrorist and attack and kill american soldiers as they have, the balls to come over off to the united states, and try to dupe the same exact same thing here from our homeland is unacceptable. Reporter: The investigation of al qaeda in kentucky was launched based on an intelligence tip forwarded to the fbi office in louisville. Kooe any time you an al qaeda operative in the u.S. It is a surprise. Reporter: At the prompting of an fbi informant, he made the DRAWINGS OF THE IEDs BACK IN Iraq. And jufr cover tapes of the informant he boasted of building a dozen or more bombs and using a snim per's rifle. He had them for lunch and dinner. He killed them. To hear that must be chilling. Gut wrenching. The big break in the warehouse outside washington. Fbi repository of every ied or bomb used against am can targets anywhere in the world. America's bomb library. Remnants of some 100,000 bombs are stored in the boxes stacked to the ceiling here as part of of a liftle known fbi uniit run by gregory carl. When you stop and think what is in the boxes really what makes you pause thinking of all the troops injured or wounded. By these devices. It really is kind of of a sacred grounds. Based on the description, the fbi undercover of the type and location of the bombs he said he built, a team of 40 fbi agents and technicians were signed to go through the remnants of 130 bombs and do stom 14,000 finger print comparisons. Then 2/3 of the way through, bingo. I said you will never believe it. Reporter: A bomb recovered in baji in the pile of rocks before it was detonated was the key. It matched in detail, the drawing of a bomb he had given the undercover fbi of a gent. Heap has the I would call that pretty sophisticated. Better as the lead fbi specialist, showed me. Fingerprints and a palm print on the detonating device, a wireless phone bay station, matched those of those in kentucky. Right here. Right there. What was that like when you made the match? The whole team was ecstatic. Finding a needle in a hey stack. Word sent back to louisville. It was a surreal moment. It was a real game changer to speak for the case. Now you have solidified proof he was involved in actual attacks against u.S. Soldiers. Reporter: This was somebody for real, not just full of empty -- for real in our backyard. Reporter: Scary? Yes. Yes. Reality of, of, it could happen in our backyard. You know, whether it is bowling green, washington, d.C., New york, it was here. Reporter: As the case continued, he brought in the second iraqi, hamadi. Both were caught in the sting. Seen on undercover cameras, loading weapons they thought were going to be shipped to iraq. Holding one of the pkn machine guns. He thought they were sending back to al qaeda forces to be used against u.S. Forces. In this, picture, unloading a stinger missile. Anti-air craft weapon. He believed would beep used against u.S. Aircraft. This one, both wad and hamadi. Are loading a crate of c 4 explosi explosives. According to prosecutors, he wanted to target a u.S. Army captain in the u.S. Assigned to the baji area. They wanted to, you know assassinate this particular u.S. Captain. Prosecutors say hamadi urged attacks on u.S. Soil. Quote, many things should take place. It should be huge. We were happy that we were able to bring justice to this individual that we knew that was involved in the kinds of acts, overseas. The two men were arrested in may, 2011. And pleaded guilty to charges of providing material support to terrorists. Sentenced to 40 years in prison. Hamadi sentenced to life. She have that opportunity. So I guess this its second best. For all the success of the undercover operation, the case raised the question of how the state department and citizenship and immigration service allowed the men to gement int into the country in the first place. How do you have somebody who you know was an actor in terrorism overseas, how does that person get into the united states. How do they get into our communities? The system failed here. If you are asking my opinion, i would say the system failed. Otherwise they wouldn't have been here in the first place. Reporter: The two got here, filling out the immigration service refugee application form. Next to the doxs, have we been involved in terrorist activity. They were proved. Both had been part of an insurgent group with his fingerprints actually in the defense department files years before he applied to come to the u.S. According to retired lieutenant jen ram, how did a person who we detained in iraq, linked to abied attack. In a government system. How did he walk into america in 2009, 2 years later before he came up on our radar screen. At a congressional hearing, a homeland security official said none of that information was available to its screamers. The checks performed at the time did come back clean. An search is under way at the fbi laboratory to go through a huge backlog of bombs from iraq and afghanistan with leads to a surprising number of other terrorists who also may have managed to move here undetected. We are currently supporting dozens of counterterrorism investigations like that. Dozens of cases. Correct. Looking for prints of people who are in the country now. Quite a thing. It is. That's what shows the sear yursness of yurs ne -- seriousness of all of this. The discover yech of alquada. The imprigs service, says it tightened security. In effect. Closing the barn door after the
This transcript has been automatically generated and may not be 100% accurate.