A male chimpanzee in a Swedish zoo planned hundreds of stone-throwing attacks on zoo visitors, according to researchers.
Keepers at Furuvik Zoo found that the chimp collected and stored stones that he would later use as missiles.
Further, the chimp learned to recognise how and when parts of his concrete enclosure could be pulled apart to fashion further projectiles.
The findings are reported in the journal Current Biology.
There has been scant evidence in previous research that animals can plan for future events.
Crucial to the current study is the fact that Santino, a chimpanzee at the zoo in the city north of Stockholm, collected the stones in a calm state, prior to the zoo opening in the morning.
The launching of the stones occurred hours later - during dominance displays to zoo visitors - with Santino in an "agitated" state.
This suggests that Santino was anticipating a future mental state - an ability that has been difficult to definitively prove in animals, according to Mathias Osvath, a cognitive scientist from Lund University in Sweden and author of the new research.
"We've done experimental studies, and the chimps in my mind show very clearly that they do plan for future needs, but it has been argued that perhaps this was an experimental artefact," Dr Osvath told BBC News.
"Now we have this spontaneous behaviour, which is always in some sense better evidence."