SAN DIEGO  At first, Luis F. Alarid seemed well on his way to becoming a customs agency success story. He had risen from a childhood of poverty and foster homes, some of them abusive, earned praise and commendations while serving in the Army and the Marines, including two tours in Iraq, and returned to Southern California to fulfill a goal of serving in law enforcement.

But, early last year, after just a few months as a customs inspector, he was waving in trucks from Mexico carrying loads of marijuana and illegal immigrants. He pocketed some $200,000 in cash that paid for, as far as the government could tell, a $15,000 motorcycle, flat-screen televisions, a laptop computer and more.

Some investigators believe that Mr. Alarid, 32, who was paid off by a Mexican smuggling crew that included several members of his family, intended to work for smugglers all along. At one point, Mr. Alarid, who was sentenced to seven years in federal prison in February, told investigators that he had researched just how much prison time he might get for his crimes and believed, as investigators later reported, that he could do it “standing on his head.”

Mr. Alarid’s case is not the only one that has law enforcement officials worried that Mexican traffickers  facing beefed-up security on the border that now includes miles of new fencing, floodlights, drones, motion sensors and cameras  have stepped up their efforts to corrupt the border police.