FRESNO, Calif. – Dozens of foreign insects and plant diseases slipped undetected into the United States in the years after 9/11, when authorities were so focused on preventing another attack that they overlooked a pest explosion that threatened the quality of the U.S. food supply.

At the time, hundreds of agricultural scientists responsible for stopping invasive species at the border were reassigned to anti-terrorism duties in the newly formed Homeland Security Department — a move scientists say cost billions of dollars in crop damage and eradication efforts from California vineyards to Florida citrus groves.

The consequences come home to consumers in the form of higher grocery prices, substandard produce and the risk of environmental damage from pest-combating chemicals .

An Associated Press analysis of inspection records found that border-protection officials were so engrossed in stopping terrorists that they all but ignored the country’s exposure to destructive new insects and infections — a quietly growing menace that has been attacking fruits and vegetables and even prized forests ever since.

“Every person in the country is affected by this, whether by the quality or cost of their food, the pesticide residue on food or not being able to enjoy the outdoors because beetles are killing off the trees,” said Mark Hoddle, an entomologist specializing in invasive species at the University of California, Riverside.

Homeland Security officials admit making mistakes and say they’re stepping up agricultural inspections at border checkpoints, airports and seaports.

While not as dire as terrorism, the threat is considerable and hard to contain.

Many invasive species are carried into the U.S. by people who are either unaware of the laws or are purposely trying to skirt quarantine regulations. The hardest to stop are fruits, vegetables and spices carried by international travelers or shipped by mail. If tainted with insects or infections, they could carry contagions capable of devastating crops.

Plants and cut flowers can harbor larvae, as can bags of bulk commodities such as rice. Beetles have been found on the bottom of tiles from Italy, and boring insects have burrowed into the wooden pallets commonly used in cargo shipments.

Invasive species have been sneaking into North America since Europeans arrived on the continent. But the abrupt shift in focus that followed the Sept. 11 attacks caused a steep decline in agricultural inspections that allowed more pests to invade American farms and forests.

Using the Freedom of Information Act, the AP obtained data on border inspections covering the period from 2001 to 2010. The analysis showed that the number of inspections, along with the number of foreign species that were stopped, fell dramatically after the Homeland Security Department was formed.

Once the pests get established, costs can quickly spiral out of control. The most widely quoted economic analysis, conducted in 2004 by Cornell University, puts the total annual cost of all invasive species in the U.S. at $120 billion. Much of that burden is borne by consumers in the form of higher food costs and by taxpayers who pay for government eradication programs.

For instance, if the destructive infection known as citrus canker were to become established in California, which produces most of the nation’s fresh oranges, consumers would pay up to $130 million more a year for the fruit, according to an ongoing study by scientists at the University of California, Davis.