In the corner of a large, dim warehouse inside the Port of Oakland, Edel Gaingalas swings a hammer into a piece of wood. She’s looking for larvae — the wood, pried off a shipping crate, is riddled with holes bored by insects who chewed their way inside looking for a home, but every one she’s found so far is dead — killed by the mandatory fumigation at the port of origin. Before the day is out, she’ll find a live longhorned beetle larva, and the whole shipment will be sent back to China.

Like many of the people in this warehouse, Gaingalas used to work at the airport, in the international terminal of San Francisco-Oakland (SFO). She went through people’s luggage all day. Now, as a U.S. Customs and Border Patrol (CBP) agricultural specialist, she mostly hunts for bugs, though she finds the occasional plant as well — like the time she found two rare orchids hidden inside a piece of furniture being imported from Asia. But she and CBP chief supervisory officer and public relations liaison Edward Low aren’t strangers to bizarre customs discoveries: Low rattles off a list of things found in SFO Airport luggage with the practiced air of a man who gets asked this question a great deal. “A cow intestine with the grass still in it,” says Low. “A human hand stuffed with straw. Penises galore. Pick an animal — we’ve found its penis in someone’s luggage.”

The greatest threat at America’s borders, however, doesn’t come from smuggled penises. The greatest threat — at least in the food security sense of the word — is a nondescript brownish insect about the size of a lentil. It’s called the Khapra beetle (aka Trogoderma granarium). It’s the only insect that the CBP has zero tolerance for.

For reasons not fully understood, the Khapra beetle has been appearing at U.S. ports in dramatically increasing numbers. In previous years, it showed up at border crossings, in shipping containers at ports, and at international airport terminals about 15 times a year. Six months into the 2011 that number had already reached 100. News of the dramatically increasing Khapra beetle interceptions began to appear in CBP press releases, running next to tales of migrant workers caught by aerial drones and businessmen smuggling erectile dysfunction drugs.

What’ll it do if it gets here? Eat all our food. The Oakland CPB team leads the nation in Khapra beetle interception (52 busts in 2011, with New York running a close second with 48), but it’s also just a few hours away from the Central Valley, one of the most productive agricultural regions in the world.

Unlike most beetles (but like most humans), the Khapra beetle never bothered to specialize in what it eats. At last count, the number of potential food sources it can survive on topped 75, most of them foods that we like to eat, and most of them also foods that we like to sell to other people and ship long distances, like oats, corn, wheat, soy, and beans.

Khapra larvae in rice.

When the Khapra discovers a new food source, it does not pause to think about how it might live harmoniously and sustainably in this new ecosystem. Instead it lays its eggs in everything. A single female can lay 500 eggs, according to Andrew R. Cline, senior insect biosystematist at the Plant Pest Diagnostics Branch of the California Department of Food & Agriculture. The insect is so small that it can hide behind a fleck of paint on the inside of a grain silo, but eyewitness accounts of infestations describe looking down into grain stores that seemed to be alive, they were so thickly coated with wiggling larvae. The Khapra beetle doesn’t leave much behind. Other insects will maybe take 30 percent of a crop, Cline says. The Khapra will take 70 percent. Or all of it.

In 1953, the beetle was discovered to have established itself in California, at which point it took millions of dollars and 13 years to remove. Among its other skills, the Khapra beetle is able to enter something called “diapause” — a sort of hibernation in which it stops growing and lowers its oxygen intake — making it much more difficult to find and kill. Other, less-established colonies were taken out in 1968 (New Jersey) and between 1980 and 1983 (California, Maryland, Michigan, New Jersey, New York, Pennsylvania, and Texas).

While it is the responsibility of customs agents to actually search for and identify invasive insects, if an agricultural pest like the Khapra beetle does get loose, responsibility for getting rid of it shifts to the states. This is why Alameda County, which surrounds the Port of Oakland, has 7,000 pheremone traps laid across it as a second line of defense in case anything manages to make it through the port and out into the world. It’s also why last year California State Senate Agriculture Committee Chair Anthony Cannella held a hearing in which he announced that he certainly hoped that funding for combating invasive species wouldn’t be cut as California confronted its epic budget deficit.

By July of 2011, the USDA and Advance Passenger Information System (APIS) were seriously alarmed at the rising numbers. Some countries, like Vietnam, began to outright ban imports of rice — the grain in which the beetle was most frequently found — from countries known to have the Khapra beetle.

But doing such a thing in the United States would be complex. The same countries that have the beetle also happen to be countries that we have delicate diplomatic relationships with, including  Afghanistan, India, Iran, Pakistan, and Saudi Arabia, as well as Senegal, Sri Lanka, Sudan, Syria, Tunisia, Turkey, and the United Arab Emirates.

So, the CBP altered its rules instead. Now, all rice imported from countries known to have the Khapra beetle needs to be accompanied by a certificate saying that it has been inspected and found to be beetle-free.

Have the new inspection certificates made a difference? Shipments, even certified ones, are still examined in the same way they always have been — by taking samples of the rice and sifting through them by hand. (Technology has brought us many wonders, but the ability to reliably detect a small insect in a sack of rice isn’t one of them.)

Agriculture was one of the first global industries. Crops planted far from the places where they originally evolved, but in climates similar to the ones they were from, did phenomenally well, often until they became weeds. This is why most of the world’s bananas are grown in Latin America, rather than Southeast Asia, and why most of the world’s almonds are grown in California, not the Middle East. Comparative advantage is rooted in plant biology.

Invasive pests are the hidden whammy folded into this scenario. When separated from all of the creatures that have evolved to eat it, a crop flourishes — like Superman shot out of Krypton and into the American Midwest. When a crop is reunited with one of its worst pests, though, it’s like Superman meets Kryptonite all over again. The Khapra beetle evolved somewhere in South Asia, in the same region where rice was first cultivated. USDA-APHIS estimates that 67 percent of the continental U.S. also has a climate suitable for the beetle.

Countries trade food for a variety of reasons. Some countries do it for purely economic reasons — India grows some delicious rice, in a country where wages are cheap. Other countries trade food for diplomatic reasons — Japan has warehouses full of American rice, for instance, because they promised to buy it years ago in World Trade Organization negotiations .

As more food crosses borders than ever before, biology is complicating both finance and diplomacy. The number of invasive plants, insects, and pathogens intercepted by CBP has nearly doubled in the last decade. It’s an upswing that prefigures a more complex economics of the future, and one that takes into account such questions as “How much do we stand to gain by importing this rice? How much do we stand to lose if importing this rice brings over an insect we have to spend millions of dollars to get rid of?”

As of January of this year, Sen. Canella had created his own Subcommittee on Invasive Species, and the Rice Exporters Association of Pakistan was meeting with the USDA in Karachi to figure out just how much of the grain is currently being sent back. And that year-end total? It turns out just as many entered the country since the restrictions were passed as had come before — and then some. The final count was 217.