It was a lengthy investigation. Lam was caught by San Jose police officers assigned to the task force on Internet crime against children. Since he lived in San Francisco, they turned the case over to police there.
Police arrested Lam almost a year and a half ago for exchanging child porn on the Internet. Investigators went to his San Francisco home and found more than 85 images and videos. Inspector Ken Esposto tells ABC7 News he was stunned at the sophistication of Lam's computer set-up.
"It was quite elaborate," Esposto said. "His resources and electronic expertise he had. I remember being at the house and he had a whole closet downstairs, like he had his own independent server, several computers, several hard drives, electronic storage devices."
Lam is a Homeland Security agent, working in Customs and Border Protection. Prosecutors say at the time of his arrest, he worked at San Francisco International Airport's security checkpoint for passengers from overseas flights.
Homeland Security launched its own lengthy investigation of Lam. The agency gave its finding to the U.S. Attorney's office for possible prosecution.
"The U.S. attorney came back to us about two weeks ago," Esposto said. "They felt it would be better prosecuted on a state level.
San Francisco prosecutors decided last week to prosecute Lam, who was re-arrested on Friday.
"No one is above the law and certainly we expect a lot more from our law enforcement officers and that makes this case extremely disturbing to me," District Attorney George Gascon said.
Gascon says his office will conduct its own probe to see how extensive Lam's networking was.
"We don't know if that file sharing network was confined only to pornography or whether there was other information there and who are the other people," Gascon said.
Late Thursday, Homeland Security issued a statement, which says in part, "We will accept nothing less than 100 percent compliance with the highest standards of integrity. We do not tolerate corruption or abuse within our ranks."
Homeland Security says Lam is still employed by Customs and Border Protection.
Lam is being held on $150,000 bail.