If a parasite invades a barberry, the plant can abort its own seeds to prevent infestation, according to new research that claims the first ecological evidence of complex behavior in plants.

Researchers from Germany's Helmholtz Center for Environmental Research (UFZ) and the University of Göttingen report that the barberry plant (Berberis vulgaris) has a structural memory that allows it to differentiate between its internal condition and its exterior environment, as well as anticipate future risks.

Writing in the theoretical ecology journal American Naturalist, the researchers report that the barberry behaves differently and is much "smarter" than its ecological relative the Oregon grape plant, both which are present in Europe.

Harald Auge, a biologist at UFZ, said that the team found a type of parasitic fruit fly on Oregon grapes in amounts ten times greater than what appears on barberry plants.

The parasitic fruit fly Rhagoletis meigenii punctures the plants' berries in order to lay its eggs inside them.

The berries of barberrry plants contain two seeds, and the plant is able to stop the development of the seeds in order to save its resources. This mechanism is also deployed to save the seeds from the fruit fly, the researchers said.

"If a seed is infested with the parasite, later on the developing larva will feed on both seeds," the researchers said in a statement. "If however the plant aborts the infested seed, then the parasite in that seed will also die and the second seed in the berry is saved."

Berries from the barberry plant typically contain two seeds, but in some cases they just contain one.

If the infested berry contains two seeds, the plant will abort an infested seed 75 percent of the time in order to save the uninfested one, the researchers found. But if the berry only contains one seed, the plant will abort it only 5 percent of the time.

"If the Barberry aborts a fruit with only one infested seed, then the entire fruit would be lost. Instead it appears to 'speculate' that the larva could die naturally, which is a possibility. Slight chances are better than none at all," the UFZ's Hans-Hermann Thulke said. "This anticipative behavior, whereby anticipated losses and outer conditions are weighed up, very much surprised us. The message of our study is therefore that plant intelligence is entering the realms of ecological possibility."

The Oregon grape, by comparison, does not possess the same sort of selective intelligence. However, why the barberry plant exhibits such complex behavior remains unclear.